Browse Source

Fix JSONAPI not parsing JSON values padded with spaces

JSONAPI couldn't parse JSON values like "  {"key": :value"}" because of
the spaces before the opening curly brace. This behaviour was judged to
be unintuitive and a bug. This patch fixes the issue by always skipping
spaces in front of the value.

This should not break parsing JSON string values, since they are
supposed to start with double quotation mark.
pull/8/head
Anton Tarasenko 2 years ago
parent
commit
5351d13a5d
  1. 1
      sources/Text/JSON/JSONAPI.uc

1
sources/Text/JSON/JSONAPI.uc

@ -821,6 +821,7 @@ public final function AcediaObject ParseWith(
if (parser == none) return none; if (parser == none) return none;
if (!parser.Ok()) return none; if (!parser.Ok()) return none;
parser.Skip();
initState = parser.GetCurrentState(); initState = parser.GetCurrentState();
TryNullWith(parser); TryNullWith(parser);
if (parser.Ok()) { if (parser.Ok()) {

Loading…
Cancel
Save