Skip to content

Commit e0dfccd

Browse files
committed
Improve document
Signed-off-by: chirsz-ever <[email protected]>
1 parent ed1d330 commit e0dfccd

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,11 +1767,11 @@ However, you can pass set parameter `ignore_comments` to true in the `parse` fun
17671767

17681768
### Trailing Commas
17691769

1770-
Trailing commas in arrays and objects are alse not part of the [JSON specification](https://tools.ietf.org/html/rfc8259), and this library does not support it by default.
1770+
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.
17711771

1772-
Like comments, you can pass set parameter `allow_trailing_commas` to true in the `parse` function to allow trailing commas in arrays and objects. Trailing commas will then be ignored.
1772+
Like comments, you can pass set parameter `allow_trailing_commas` to true in the `parse` function to allow trailing commas in arrays and objects. Trailing commas will then be ignored. Note that a single comma as the only content of the array or object (`[,]` or `{,}`) is not allowed.
17731773

1774-
Note that this library does not add trailing commas when serializing JSON data. Even when you set `allow_trailing_commas` to true, `{,}` and `[,]` are not valid JSON.
1774+
This library does not add trailing commas when serializing JSON data.
17751775

17761776
### Order of object keys
17771777

docs/mkdocs/docs/features/trailing_commas.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
Like comments, this library does not support trailing commas in arrays and objects *by default*.
44

5-
You can pass set parameter `allow_trailing_commas` to `#!c true` in the parse function to allow trailing commas in arrays and objects. Trailing commas are ignored during parsing.
5+
You can pass set parameter `allow_trailing_commas` to `#!cpp true` in the parse function to allow trailing commas in arrays and objects. Trailing commas are ignored during parsing. Note that a single comma as the only content of the array or object (`[,]` or `{,}`) is not allowed.
66

7-
Note that this library does not add trailing commas when serializing JSON data. Even when you set `allow_trailing_commas` to true, `{,}` and `[,]` are not valid JSON.
7+
This library does not add trailing commas when serializing JSON data.
88

99
!!! example
1010

@@ -69,9 +69,8 @@ Note that this library does not add trailing commas when serializing JSON data.
6969
Output:
7070

7171
```
72-
[json.exception.parse_error.101] parse error at line 3, column 9:
73-
syntax error while parsing object key - invalid literal;
74-
last read: '<U+000A> {<U+000A> /'; expected string literal
72+
[json.exception.parse_error.101] parse error at line 11, column 13:
73+
syntax error while parsing value - unexpected ']'; expected '[', '{', or a literal
7574
```
7675

7776
```json

0 commit comments

Comments
 (0)