Skip to content

Commit 4424a0f

Browse files
authored
📝 update documentation (#4723)
Signed-off-by: Niels Lohmann <[email protected]>
1 parent 11aa5f9 commit 4424a0f

File tree

90 files changed

+377
-339
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+377
-339
lines changed

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,6 +1706,44 @@ I deeply appreciate the help of the following people.
17061706
344. [Aleksei Sapitskii](https://github.com/aleksproger) added support for Apple's Swift Package Manager.
17071707
345. [Benjamin Buch](https://github.com/bebuch) fixed the installation path in CMake.
17081708
346. [Colby Haskell](https://github.com/colbychaskell) clarified the parse error message in case a file cannot be opened.
1709+
347. [Juan Carlos Arevalo Baeza](https://github.com/TheJCAB) fixed the enum conversion.
1710+
348. [alferov](https://github.com/ALF-ONE) fixed a version in the documentation.
1711+
349. [ss](https://github.com/serge-s) fixed the amalgamation call.
1712+
350. [AniketDhemare](https://github.com/AniketDhemare) fixed a version in the documentation.
1713+
351. [Philip Müller](https://github.com/philip-paul-mueller) fixed an example.
1714+
352. [Leila Shcheglova](https://github.com/LeilaShcheglova) fixed a warning in a test.
1715+
353. [Alex Prabhat Bara](https://github.com/alexprabhat99) fixed a function name in the documentation.
1716+
354. [laterlaugh](https://github.com/laterlaugh) fixed some typos.
1717+
355. [Yuanhao Jia](https://github.com/MrJia1997) fixed the GDB pretty printer.
1718+
356. [Fallen_Breath](https://github.com/Fallen-Breath) fixed an example for JSON Pointer.
1719+
357. [Nikhil Idiculla](https://github.com/tsnl) fixed some typos.
1720+
358. [Griffin Myers](https://github.com/gmyers18) updated the Natvis file.
1721+
359. [thetimr](https://github.com/thetimr) fixed a typo in the documentation.
1722+
360. [Balazs Erseki](https://github.com/zerocukor287) fixed a URL in the contribution guidelines.
1723+
361. [Niccolò Iardella](https://github.com/rotolof) added `NLOHMANN_DEFINE_DERIVED_TYPE_*` macros.
1724+
362. [Borislav Stanimirov](https://github.com/iboB) allowed overriding the CMake target name.
1725+
363. [Captain Crutches](https://github.com/captaincrutches) made `iterator_proxy_value` a `std::forward_iterator`.
1726+
364. [Fredrik Sandhei](https://github.com/fsandhei) added type conversion support for `std::optional`.
1727+
365. [jh96](https://github.com/jordan-hoang) added exceptions when `nullptr` is passed to `parse`.
1728+
366. [Stuart Gorman](https://github.com/StuartGorman) fixed number parsing when `EINTR` set in `errno`.
1729+
367. [Dylan Baker](https://github.com/dcbaker) generated a pkg-config file that follows the pkg-config conventions.
1730+
368. [Tianyi Chen](https://github.com/TianyiChen) optimized the binary `get_number` implementation.
1731+
369. [peng-wang-cn](https://github.com/peng-wang-cn) added type conversion support for multidimensional arrays.
1732+
370. [Einars Netlis-Galejs](https://github.com/EinarsNG) added `ONLY_SERIALIZE` for `NLOHMANN_DEFINE_DERIVED_TYPE_*` macros.
1733+
371. [Marcel](https://github.com/mering) removed `alwayslink=True` Bazel flag.
1734+
372. [Harinath Nampally](https://github.com/hnampally) added diagnostic positions to exceptions.
1735+
373. [Nissim Armand Ben Danan](https://github.com/NissimBendanan) fixed `NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT` with an empty JSON instance.
1736+
374. [Michael Valladolid](https://github.com/codenut) added support for BSON uint64 serialization/deserialization.
1737+
375. [Nikhil](https://github.com/nikhilreddydev) updated the documentation.
1738+
376. [Nebojša Cvetković](https://github.com/nebkat) added support for BJDATA optimized binary array type.
1739+
377. [Sushrut Shringarputale](https://github.com/sushshring) added support for diagnostic positions.
1740+
378. [kimci86](https://github.com/kimci86) templated to `NLOHMANN_DEFINE_TYPE` macros to also support `ordered_json`.
1741+
379. [Richard Topchii](https://github.com/richardtop) added support for VisionOS in the Swift Package Manager.
1742+
380. [Robert Chisholm](https://github.com/Robadob) fixed a typo.
1743+
381. [zjyhjqs](https://github.com/zjyhjqs) added CPack support.
1744+
382. [bitFiedler](https://github.com/bitFiedler) made GDB pretty printer work with Python 3.8.
1745+
383. [Gianfranco Costamagna](https://github.com/LocutusOfBorg) fixed a compiler warning.
1746+
384. [risa2000](https://github.com/risa2000) made `std::filesystem::path` conversion to/from UTF-8 encoded string explicit.
17091747

17101748
Thanks a lot for helping out! Please [let me know](mailto:[email protected]) if I forgot someone.
17111749

docs/mkdocs/docs/api/basic_json/accept.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ Checks whether the input is valid JSON.
1717
1. Reads from a compatible input.
1818
2. Reads from a pair of character iterators
1919
20-
The value_type of the iterator must be an integral type with size of 1, 2 or 4 bytes, which will be interpreted
21-
respectively as UTF-8, UTF-16 and UTF-32.
20+
The value_type of the iterator must be an integral type with a size of 1, 2, or 4 bytes, which will be interpreted
21+
respectively as UTF-8, UTF-16, and UTF-32.
2222
2323
Unlike the [`parse()`](parse.md) function, this function neither throws an exception in case of invalid JSON input
2424
(i.e., a parse error) nor creates diagnostic information.
@@ -51,10 +51,10 @@ Unlike the [`parse()`](parse.md) function, this function neither throws an excep
5151
(`#!cpp false`); (optional, `#!cpp false` by default)
5252
5353
`first` (in)
54-
: iterator to start of character range
54+
: iterator to the start of the character range
5555
5656
`last` (in)
57-
: iterator to end of character range
57+
: iterator to the end of the character range
5858
5959
## Return value
6060
@@ -101,7 +101,7 @@ A UTF-8 byte order mark is silently ignored.
101101
102102
- Added in version 3.0.0.
103103
- Ignoring comments via `ignore_comments` added in version 3.9.0.
104-
- Changed [runtime assertion](../../features/assertions.md) in case of `FILE*` null pointers to exception in version 3.11.4.
104+
- Changed [runtime assertion](../../features/assertions.md) in case of `FILE*` null pointers to exception in version 3.12.0.
105105
106106
!!! warning "Deprecation"
107107

docs/mkdocs/docs/api/basic_json/at.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,29 +59,29 @@ Strong exception safety: if an exception occurs, the original value stays intact
5959
6060
1. The function can throw the following exceptions:
6161
- Throws [`type_error.304`](../../home/exceptions.md#jsonexceptiontype_error304) if the JSON value is not an array;
62-
in this case, calling `at` with an index makes no sense. See example below.
62+
in this case, calling `at` with an index makes no sense. See the example below.
6363
- Throws [`out_of_range.401`](../../home/exceptions.md#jsonexceptionout_of_range401) if the index `idx` is out of
64-
range of the array; that is, `idx >= size()`. See example below.
64+
range of the array; that is, `idx >= size()`. See the example below.
6565
2. The function can throw the following exceptions:
6666
- Throws [`type_error.304`](../../home/exceptions.md#jsonexceptiontype_error304) if the JSON value is not an object;
67-
in this case, calling `at` with a key makes no sense. See example below.
67+
in this case, calling `at` with a key makes no sense. See the example below.
6868
- Throws [`out_of_range.403`](../../home/exceptions.md#jsonexceptionout_of_range403) if the key `key` is not
69-
stored in the object; that is, `find(key) == end()`. See example below.
69+
stored in the object; that is, `find(key) == end()`. See the example below.
7070
3. See 2.
7171
4. The function can throw the following exceptions:
7272
- Throws [`parse_error.106`](../../home/exceptions.md#jsonexceptionparse_error106) if an array index in the passed
73-
JSON pointer `ptr` begins with '0'. See example below.
73+
JSON pointer `ptr` begins with '0'. See the example below.
7474
- Throws [`parse_error.109`](../../home/exceptions.md#jsonexceptionparse_error109) if an array index in the passed
75-
JSON pointer `ptr` is not a number. See example below.
75+
JSON pointer `ptr` is not a number. See the example below.
7676
- Throws [`out_of_range.401`](../../home/exceptions.md#jsonexceptionout_of_range401) if an array index in the passed
77-
JSON pointer `ptr` is out of range. See example below.
77+
JSON pointer `ptr` is out of range. See the example below.
7878
- Throws [`out_of_range.402`](../../home/exceptions.md#jsonexceptionout_of_range402) if the array index '-' is used
7979
in the passed JSON pointer `ptr`. As `at` provides checked access (and no elements are implicitly inserted), the
80-
index '-' is always invalid. See example below.
80+
index '-' is always invalid. See the example below.
8181
- Throws [`out_of_range.403`](../../home/exceptions.md#jsonexceptionout_of_range403) if the JSON pointer describes a
82-
key of an object which cannot be found. See example below.
82+
key of an object which cannot be found. See the example below.
8383
- Throws [`out_of_range.404`](../../home/exceptions.md#jsonexceptionout_of_range404) if the JSON pointer `ptr` can
84-
not be resolved. See example below.
84+
not be resolved. See the example below.
8585
8686
## Complexity
8787

docs/mkdocs/docs/api/basic_json/back.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ return *tmp;
1717

1818
## Return value
1919

20-
In case of a structured type (array or object), a reference to the last element is returned. In case of number, string,
21-
boolean, or binary values, a reference to the value is returned.
20+
In the case of a structured type (array or object), a reference to the last element is returned. In the case of number,
21+
string, boolean, or binary values, a reference to the value is returned.
2222

2323
## Exception safety
2424

docs/mkdocs/docs/api/basic_json/basic_json.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ basic_json(basic_json&& other) noexcept;
9999
2. C++ has no way of describing mapped types other than to list a list of pairs. As JSON requires that keys must be
100100
of type string, rule 2 is the weakest constraint one can pose on initializer lists to interpret them as an
101101
object.
102-
3. In all other cases, the initializer list could not be interpreted as JSON object type, so interpreting it as JSON
103-
array type is safe.
102+
3. In all other cases, the initializer list could not be interpreted as a JSON object type, so interpreting it as a
103+
JSON array type is safe.
104104
105105
With the rules described above, the following JSON values cannot be expressed by an initializer list:
106106
@@ -113,7 +113,7 @@ basic_json(basic_json&& other) noexcept;
113113
6. Constructs a JSON array value by creating `cnt` copies of a passed value. In case `cnt` is `0`, an empty array is
114114
created.
115115
116-
7. Constructs the JSON value with the contents of the range `[first, last)`. The semantics depends on the different
116+
7. Constructs the JSON value with the contents of the range `[first, last)`. The semantics depend on the different
117117
types a JSON value can have:
118118
119119
- In case of a `#!json null` type, [invalid_iterator.206](../../home/exceptions.md#jsonexceptioninvalid_iterator206)
@@ -175,10 +175,10 @@ basic_json(basic_json&& other) noexcept;
175175
: the number of JSON copies of `val` to create
176176
177177
`first` (in)
178-
: begin of the range to copy from (included)
178+
: the beginning of the range to copy from (included)
179179
180180
`last` (in)
181-
: end of the range to copy from (excluded)
181+
: the end of the range to copy from (excluded)
182182
183183
`other` (in)
184184
: the JSON value to copy/move
@@ -188,10 +188,10 @@ basic_json(basic_json&& other) noexcept;
188188
1. Strong guarantee: if an exception is thrown, there are no changes to any JSON value.
189189
2. No-throw guarantee: this constructor never throws exceptions.
190190
3. Depends on the called constructor. For types directly supported by the library (i.e., all types for which no
191-
`to_json()` function was provided), strong guarantee holds: if an exception is thrown, there are no changes to any
191+
`to_json()` function was provided), a strong guarantee holds: if an exception is thrown, there are no changes to any
192192
JSON value.
193193
4. Depends on the called constructor. For types directly supported by the library (i.e., all types for which no
194-
`to_json()` function was provided), strong guarantee holds: if an exception is thrown, there are no changes to any
194+
`to_json()` function was provided), a strong guarantee holds: if an exception is thrown, there are no changes to any
195195
JSON value.
196196
5. Strong guarantee: if an exception is thrown, there are no changes to any JSON value.
197197
6. Strong guarantee: if an exception is thrown, there are no changes to any JSON value.
@@ -217,7 +217,7 @@ basic_json(basic_json&& other) noexcept;
217217
`[first, last)` is undefined.
218218
- Throws [`invalid_iterator.204`](../../home/exceptions.md#jsonexceptioninvalid_iterator204) if iterators `first`
219219
and `last` belong to a primitive type (number, boolean, or string), but `first` does not point to the first
220-
element anymore. In this case, the range `[first, last)` is undefined. See example code below.
220+
element anymore. In this case, the range `[first, last)` is undefined. See the example code below.
221221
- Throws [`invalid_iterator.206`](../../home/exceptions.md#jsonexceptioninvalid_iterator206) if iterators `first`
222222
and `last` belong to a `#!json null` value. In this case, the range `[first, last)` is undefined.
223223
8. (none)
@@ -333,7 +333,7 @@ basic_json(basic_json&& other) noexcept;
333333
--8<-- "examples/basic_json__list_init_t.output"
334334
```
335335
336-
??? example "Example: (6) construct an array with count copies of given value"
336+
??? example "Example: (6) construct an array with count copies of a given value"
337337
338338
The following code shows examples for creating arrays with several copies of a given value.
339339

docs/mkdocs/docs/api/basic_json/binary.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ create a value for serialization to those formats.
2121
## Parameters
2222
2323
`init` (in)
24-
: container containing bytes to use as binary type
24+
: container containing bytes to use as a binary type
2525
2626
`subtype` (in)
2727
: subtype to use in CBOR, MessagePack, and BSON
@@ -42,8 +42,8 @@ Linear in the size of `init`; constant for `typename binary_t::container_type&&
4242
4343
Note, this function exists because of the difficulty in correctly specifying the correct template overload in the
4444
standard value ctor, as both JSON arrays and JSON binary arrays are backed with some form of a `std::vector`. Because
45-
JSON binary arrays are a non-standard extension it was decided that it would be best to prevent automatic initialization
46-
of a binary array type, for backwards compatibility and so it does not happen on accident.
45+
JSON binary arrays are a non-standard extension, it was decided that it would be best to prevent automatic
46+
initialization of a binary array type, for backwards compatibility and so it does not happen on accident.
4747
4848
## Examples
4949

docs/mkdocs/docs/api/basic_json/binary_t.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ type `#!cpp binary_t*` must be dereferenced.
5656
- MessagePack
5757
- If a subtype is given and the binary array contains exactly 1, 2, 4, 8, or 16 elements, the fixext family (fixext1,
5858
fixext2, fixext4, fixext8) is used. For other sizes, the ext family (ext8, ext16, ext32) is used. The subtype is
59-
then added as signed 8-bit integer.
59+
then added as a signed 8-bit integer.
6060
- If no subtype is given, the bin family (bin8, bin16, bin32) is used.
6161

6262
- BSON
63-
- If a subtype is given, it is used and added as unsigned 8-bit integer.
63+
- If a subtype is given, it is used and added as an unsigned 8-bit integer.
6464
- If no subtype is given, the generic binary subtype 0x00 is used.
6565

6666
## Examples
@@ -86,4 +86,4 @@ type `#!cpp binary_t*` must be dereferenced.
8686

8787
## Version history
8888

89-
- Added in version 3.8.0. Changed type of subtype to `std::uint64_t` in version 3.10.0.
89+
- Added in version 3.8.0. Changed the type of subtype to `std::uint64_t` in version 3.10.0.

docs/mkdocs/docs/api/basic_json/clear.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Linear in the size of the JSON value.
3333

3434
## Notes
3535

36-
All iterators, pointers and references related to this container are invalidated.
36+
All iterators, pointers, and references related to this container are invalidated.
3737

3838
## Examples
3939

docs/mkdocs/docs/api/basic_json/contains.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ bool contains(const json_pointer& ptr) const;
3535
3636
## Return value
3737
38-
1. `#!cpp true` if an element with specified `key` exists. If no such element with such key is found or the JSON value
38+
1. `#!cpp true` if an element with specified `key` exists. If no such element with such a key is found or the JSON value
3939
is not an object, `#!cpp false` is returned.
4040
2. See 1.
4141
3. `#!cpp true` if the JSON pointer can be resolved to a stored value, `#!cpp false` otherwise.

docs/mkdocs/docs/api/basic_json/dump.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ string_t dump(const int indent = -1,
88
```
99
1010
Serialization function for JSON values. The function tries to mimic Python's
11-
[`json.dumps()` function](https://docs.python.org/2/library/json.html#json.dump), and currently supports its `indent`
11+
[`json.dumps()` function](https://docs.python.org/2/library/json.html#json.dump), and currently supports its `indent`
1212
and `ensure_ascii` parameters.
1313
1414
## Parameters
@@ -49,7 +49,7 @@ Linear.
4949
5050
## Notes
5151
52-
Binary values are serialized as object containing two keys:
52+
Binary values are serialized as an object containing two keys:
5353
5454
- "bytes": an array of bytes as integers
5555
- "subtype": the subtype as integer or `#!json null` if the binary has no subtype

0 commit comments

Comments
 (0)