Browse Source

Fix JSON API parsing subitems as old collections

When parsing values inside JSON object/array, stored objects and arrays
would always be parsed as `DynamicArray`/`AssociativeArray`, despite
starting parsing as new collections.
pull/8/head
Anton Tarasenko 2 years ago
parent
commit
74118e3229
  1. 4
      sources/Text/JSON/JSONAPI.uc

4
sources/Text/JSON/JSONAPI.uc

@ -724,7 +724,7 @@ public final function ArrayList ParseArrayListWith(
confirmedState = parser.GetCurrentState(); confirmedState = parser.GetCurrentState();
} }
// Parse next value // Parse next value
nextValue = ParseWith(parser, parseAsMutable); nextValue = ParseWith(parser, parseAsMutable, true);
parsedValues[parsedValues.length] = nextValue; parsedValues[parsedValues.length] = nextValue;
if (!parser.Ok()) { if (!parser.Ok()) {
break; break;
@ -914,7 +914,7 @@ private function HashTable.Entry ParseHashTableProperty(
local HashTable.Entry entry; local HashTable.Entry entry;
parser.MStringLiteral(nextKey).Skip().Match(T(default.TCOLON)).Skip(); parser.MStringLiteral(nextKey).Skip().Match(T(default.TCOLON)).Skip();
entry.key = nextKey.IntoText(); entry.key = nextKey.IntoText();
entry.value = ParseWith(parser, parseAsMutable); entry.value = ParseWith(parser, parseAsMutable, true);
return entry; return entry;
} }

Loading…
Cancel
Save