From 86d28891f50d3453e2de3d72d3ac0863b9c5e649 Mon Sep 17 00:00:00 2001 From: chirsz-ever Date: Mon, 27 Jan 2025 18:51:06 +0800 Subject: [PATCH] Improve documentation Signed-off-by: chirsz-ever --- README.md | 2 +- docs/mkdocs/docs/api/basic_json/accept.md | 2 +- docs/mkdocs/docs/api/basic_json/parse.md | 2 +- docs/mkdocs/docs/api/basic_json/sax_parse.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6fd7d450e..133bff54f 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/docs/mkdocs/docs/api/basic_json/accept.md b/docs/mkdocs/docs/api/basic_json/accept.md index 7670a9fb3..dfebb59e7 100644 --- a/docs/mkdocs/docs/api/basic_json/accept.md +++ b/docs/mkdocs/docs/api/basic_json/accept.md @@ -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) diff --git a/docs/mkdocs/docs/api/basic_json/parse.md b/docs/mkdocs/docs/api/basic_json/parse.md index eacdb5a3c..12a8eed72 100644 --- a/docs/mkdocs/docs/api/basic_json/parse.md +++ b/docs/mkdocs/docs/api/basic_json/parse.md @@ -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) diff --git a/docs/mkdocs/docs/api/basic_json/sax_parse.md b/docs/mkdocs/docs/api/basic_json/sax_parse.md index 6c207b8f8..effb8eef6 100644 --- a/docs/mkdocs/docs/api/basic_json/sax_parse.md +++ b/docs/mkdocs/docs/api/basic_json/sax_parse.md @@ -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)