Make JSON parser perfectly conformant

This commit is contained in:
Justine Tunney 2022-07-13 23:02:19 -07:00
parent 60164a7266
commit b707fca77a
7 changed files with 260 additions and 183 deletions

View file

@ -725,16 +725,12 @@ FUNCTIONS
output is valid. Please note that invalid utf-8 could still
happen if it's encoded as utf-8.
This parser is lenient about commas and colons. For example
it's permissible to say `DecodeJson('[1 2 3 4]')`. Trailing
commas are allowed. Even prefix commas are allowed. However
it's not recommended that you rely on this behavior, and it
won't round-trip with EncodeJson() currently.
When objects are parsed, your Lua object can't preserve the
the original ordering of fields. As such, they'll be sorted
by EncodeJson() and may not round-trip with original intent
This parser has perfect conformance with JSONTestSuite.
EncodeJson(value[, options:table])
├─→ json:str
├─→ true [if useoutput]