allow a single trailing comma in objects or arrays

This commit is contained in:
alisdair sullivan 2014-08-19 17:47:44 -07:00
parent c25bb49902
commit 6b43609730
4 changed files with 56 additions and 0 deletions

View file

@ -133,6 +133,10 @@ number of ways. see the section on `strict` in [options](#option) below though
json has no official comments but this parser allows c/c++ style comments.
anywhere whitespace is allowed you can insert comments (both `// ...` and `/* ... */`)
some particularly irresponsible json emitters leave trailing commas at the end of
objects or arrays. **jsx** allows a single trailing comma in input. multiple commas
in any posistion or a preceding comma are still errors
all **jsx** decoder input should be `utf8` encoded binaries. sometimes you get binaries
that are almost but not quite valid utf8 whether due to improper escaping or poor
encoding. **jsx** replaces invalid codepoints and poorly formed sequences with the
@ -337,6 +341,7 @@ option() = escaped_forward_slashes
| stream
strict_option() = comments
| trailing_commas
| utf8
| single_quotes
| escapes
@ -390,6 +395,10 @@ additional options beyond these. see
comments are disabled and result in a `badarg` error
* `trailing_commas`
trailing commas in an object or list result in `badarg` errors
* `utf8`
invalid codepoints and malformed unicode result in `badarg` errors