Skip to content

Commit

Permalink
Storage.readJSON will now read numeric field names like "{1:1}" which…
Browse files Browse the repository at this point in the history
… can be produced by writeJSON (fix #2484)
  • Loading branch information
gfwilliams committed Apr 15, 2024
1 parent 0325da0 commit b251d83
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
Graphics: Fix wrapString when attempting to wrap text containing an image that's too large for the wrappable area (fix #2481)
Add String.replaceAll to allow all occurrances of a string to be replaced (previously .replace(/substr/g, "") had to be used)
Jolt.js: Jolt.Q0/1/2/3 now available as global vars (Q0/1/2/3)
Storage.readJSON will now read numeric field names like "{1:1}" which can be produced by writeJSON (fix #2484)

2v21 : nRF52: free up 800b more flash by removing vector table padding
Throw Exception when a Promise tries to resolve with another Promise (#2450)
Expand Down
4 changes: 2 additions & 2 deletions src/jswrap_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ JsVar *jswrap_json_parse_internal(JSONFlags flags) {
case '{': {
JsVar *obj = jsvNewObject(); if (!obj) return 0;
jslGetNextToken(); // {
while ((lex->tk == LEX_STR || jslIsIDOrReservedWord()) && !jspHasError()) {
if (!(flags&JSON_DROP_QUOTES) && jslIsIDOrReservedWord()) {
while ((lex->tk == LEX_STR || lex->tk == LEX_INT || jslIsIDOrReservedWord()) && !jspHasError()) {
if (!(flags&JSON_DROP_QUOTES) && (jslIsIDOrReservedWord() || lex->tk == LEX_INT)) {
jslMatch(LEX_STR);
return obj;
}
Expand Down

0 comments on commit b251d83

Please sign in to comment.