Improve documentation
Signed-off-by: chirsz-ever <chirsz@foxmail.com>
This commit is contained in:
parent
44a50e7e2a
commit
86d28891f5
@ -1767,7 +1767,7 @@ However, you can set set parameter `ignore_comments` to true in the `parse` func
|
||||
|
||||
### Trailing commas
|
||||
|
||||
Trailing commas in arrays and objects are also not part of the [JSON specification](https://tools.ietf.org/html/rfc8259), and this library does not support it by default.
|
||||
The JSON specification does not allow trailing commas in arrays and objects, and hence this library is treating them as parsing errors by default.
|
||||
|
||||
Like comments, you can set parameter `ignore_trailing_commas` to true in the `parse` function to ignore trailing commas in arrays and objects. Note that a single comma as the only content of the array or object (`[,]` or `{,}`) is not allowed, and multiple trailing commas (`[1,,]`) are not allowed either.
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ Unlike the [`parse()`](parse.md) function, this function neither throws an excep
|
||||
(`#!cpp false`); (optional, `#!cpp false` by default)
|
||||
|
||||
`ignore_trailing_commas` (in)
|
||||
: whether trailing commas in arrays or objects should be allowed (`#!cpp true`) or yield a parse error
|
||||
: whether trailing commas in arrays or objects should be ignored and treated like whitespace (`#!cpp true`) or yield a parse error
|
||||
(`#!cpp false`); (optional, `#!cpp false` by default)
|
||||
|
||||
`first` (in)
|
||||
|
||||
@ -59,7 +59,7 @@ static basic_json parse(IteratorType first, IteratorType last,
|
||||
(`#!cpp false`); (optional, `#!cpp false` by default)
|
||||
|
||||
`ignore_trailing_commas` (in)
|
||||
: whether trailing commas in arrays or objects should be allowed (`#!cpp true`) or yield a parse error
|
||||
: whether trailing commas in arrays or objects should be ignored and treated like whitespace (`#!cpp true`) or yield a parse error
|
||||
(`#!cpp false`); (optional, `#!cpp false` by default)
|
||||
|
||||
`first` (in)
|
||||
|
||||
@ -68,7 +68,7 @@ The SAX event lister must follow the interface of [`json_sax`](../json_sax/index
|
||||
(`#!cpp false`); (optional, `#!cpp false` by default)
|
||||
|
||||
`ignore_trailing_commas` (in)
|
||||
: whether trailing commas in arrays or objects should be allowed (`#!cpp true`) or yield a parse error
|
||||
: whether trailing commas in arrays or objects should be ignored and treated like whitespace (`#!cpp true`) or yield a parse error
|
||||
(`#!cpp false`); (optional, `#!cpp false` by default)
|
||||
|
||||
`first` (in)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user