diff --git a/README.md b/README.md index 207c81ca0..bfb8ad602 100644 --- a/README.md +++ b/README.md @@ -1706,6 +1706,44 @@ I deeply appreciate the help of the following people. 344. [Aleksei Sapitskii](https://github.com/aleksproger) added support for Apple's Swift Package Manager. 345. [Benjamin Buch](https://github.com/bebuch) fixed the installation path in CMake. 346. [Colby Haskell](https://github.com/colbychaskell) clarified the parse error message in case a file cannot be opened. +347. [Juan Carlos Arevalo Baeza](https://github.com/TheJCAB) fixed the enum conversion. +348. [alferov](https://github.com/ALF-ONE) fixed a version in the documentation. +349. [ss](https://github.com/serge-s) fixed the amalgamation call. +350. [AniketDhemare](https://github.com/AniketDhemare) fixed a version in the documentation. +351. [Philip Müller](https://github.com/philip-paul-mueller) fixed an example. +352. [Leila Shcheglova](https://github.com/LeilaShcheglova) fixed a warning in a test. +353. [Alex Prabhat Bara](https://github.com/alexprabhat99) fixed a function name in the documentation. +354. [laterlaugh](https://github.com/laterlaugh) fixed some typos. +355. [Yuanhao Jia](https://github.com/MrJia1997) fixed the GDB pretty printer. +356. [Fallen_Breath](https://github.com/Fallen-Breath) fixed an example for JSON Pointer. +357. [Nikhil Idiculla](https://github.com/tsnl) fixed some typos. +358. [Griffin Myers](https://github.com/gmyers18) updated the Natvis file. +359. [thetimr](https://github.com/thetimr) fixed a typo in the documentation. +360. [Balazs Erseki](https://github.com/zerocukor287) fixed a URL in the contribution guidelines. +361. [Niccolò Iardella](https://github.com/rotolof) added `NLOHMANN_DEFINE_DERIVED_TYPE_*` macros. +362. [Borislav Stanimirov](https://github.com/iboB) allowed overriding the CMake target name. +363. [Captain Crutches](https://github.com/captaincrutches) made `iterator_proxy_value` a `std::forward_iterator`. +364. [Fredrik Sandhei](https://github.com/fsandhei) added type conversion support for `std::optional`. +365. [jh96](https://github.com/jordan-hoang) added exceptions when `nullptr` is passed to `parse`. +366. [Stuart Gorman](https://github.com/StuartGorman) fixed number parsing when `EINTR` set in `errno`. +367. [Dylan Baker](https://github.com/dcbaker) generated a pkg-config file that follows the pkg-config conventions. +368. [Tianyi Chen](https://github.com/TianyiChen) optimized the binary `get_number` implementation. +369. [peng-wang-cn](https://github.com/peng-wang-cn) added type conversion support for multidimensional arrays. +370. [Einars Netlis-Galejs](https://github.com/EinarsNG) added `ONLY_SERIALIZE` for `NLOHMANN_DEFINE_DERIVED_TYPE_*` macros. +371. [Marcel](https://github.com/mering) removed `alwayslink=True` Bazel flag. +372. [Harinath Nampally](https://github.com/hnampally) added diagnostic positions to exceptions. +373. [Nissim Armand Ben Danan](https://github.com/NissimBendanan) fixed `NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT` with an empty JSON instance. +374. [Michael Valladolid](https://github.com/codenut) added support for BSON uint64 serialization/deserialization. +375. [Nikhil](https://github.com/nikhilreddydev) updated the documentation. +376. [Nebojša Cvetković](https://github.com/nebkat) added support for BJDATA optimized binary array type. +377. [Sushrut Shringarputale](https://github.com/sushshring) added support for diagnostic positions. +378. [kimci86](https://github.com/kimci86) templated to `NLOHMANN_DEFINE_TYPE` macros to also support `ordered_json`. +379. [Richard Topchii](https://github.com/richardtop) added support for VisionOS in the Swift Package Manager. +380. [Robert Chisholm](https://github.com/Robadob) fixed a typo. +381. [zjyhjqs](https://github.com/zjyhjqs) added CPack support. +382. [bitFiedler](https://github.com/bitFiedler) made GDB pretty printer work with Python 3.8. +383. [Gianfranco Costamagna](https://github.com/LocutusOfBorg) fixed a compiler warning. +384. [risa2000](https://github.com/risa2000) made `std::filesystem::path` conversion to/from UTF-8 encoded string explicit. Thanks a lot for helping out! Please [let me know](mailto:mail@nlohmann.me) if I forgot someone. diff --git a/docs/mkdocs/docs/api/basic_json/accept.md b/docs/mkdocs/docs/api/basic_json/accept.md index 43d5eff98..152069846 100644 --- a/docs/mkdocs/docs/api/basic_json/accept.md +++ b/docs/mkdocs/docs/api/basic_json/accept.md @@ -17,8 +17,8 @@ Checks whether the input is valid JSON. 1. Reads from a compatible input. 2. Reads from a pair of character iterators - The value_type of the iterator must be an integral type with size of 1, 2 or 4 bytes, which will be interpreted - respectively as UTF-8, UTF-16 and UTF-32. + The value_type of the iterator must be an integral type with a size of 1, 2, or 4 bytes, which will be interpreted + respectively as UTF-8, UTF-16, and UTF-32. Unlike the [`parse()`](parse.md) function, this function neither throws an exception in case of invalid JSON input (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 (`#!cpp false`); (optional, `#!cpp false` by default) `first` (in) -: iterator to start of character range +: iterator to the start of the character range `last` (in) -: iterator to end of character range +: iterator to the end of the character range ## Return value @@ -101,7 +101,7 @@ A UTF-8 byte order mark is silently ignored. - Added in version 3.0.0. - Ignoring comments via `ignore_comments` added in version 3.9.0. -- Changed [runtime assertion](../../features/assertions.md) in case of `FILE*` null pointers to exception in version 3.11.4. +- Changed [runtime assertion](../../features/assertions.md) in case of `FILE*` null pointers to exception in version 3.12.0. !!! warning "Deprecation" diff --git a/docs/mkdocs/docs/api/basic_json/at.md b/docs/mkdocs/docs/api/basic_json/at.md index 641f0d736..800b46eb3 100644 --- a/docs/mkdocs/docs/api/basic_json/at.md +++ b/docs/mkdocs/docs/api/basic_json/at.md @@ -59,29 +59,29 @@ Strong exception safety: if an exception occurs, the original value stays intact 1. The function can throw the following exceptions: - Throws [`type_error.304`](../../home/exceptions.md#jsonexceptiontype_error304) if the JSON value is not an array; - in this case, calling `at` with an index makes no sense. See example below. + in this case, calling `at` with an index makes no sense. See the example below. - Throws [`out_of_range.401`](../../home/exceptions.md#jsonexceptionout_of_range401) if the index `idx` is out of - range of the array; that is, `idx >= size()`. See example below. + range of the array; that is, `idx >= size()`. See the example below. 2. The function can throw the following exceptions: - Throws [`type_error.304`](../../home/exceptions.md#jsonexceptiontype_error304) if the JSON value is not an object; - in this case, calling `at` with a key makes no sense. See example below. + in this case, calling `at` with a key makes no sense. See the example below. - Throws [`out_of_range.403`](../../home/exceptions.md#jsonexceptionout_of_range403) if the key `key` is not - stored in the object; that is, `find(key) == end()`. See example below. + stored in the object; that is, `find(key) == end()`. See the example below. 3. See 2. 4. The function can throw the following exceptions: - Throws [`parse_error.106`](../../home/exceptions.md#jsonexceptionparse_error106) if an array index in the passed - JSON pointer `ptr` begins with '0'. See example below. + JSON pointer `ptr` begins with '0'. See the example below. - Throws [`parse_error.109`](../../home/exceptions.md#jsonexceptionparse_error109) if an array index in the passed - JSON pointer `ptr` is not a number. See example below. + JSON pointer `ptr` is not a number. See the example below. - Throws [`out_of_range.401`](../../home/exceptions.md#jsonexceptionout_of_range401) if an array index in the passed - JSON pointer `ptr` is out of range. See example below. + JSON pointer `ptr` is out of range. See the example below. - Throws [`out_of_range.402`](../../home/exceptions.md#jsonexceptionout_of_range402) if the array index '-' is used in the passed JSON pointer `ptr`. As `at` provides checked access (and no elements are implicitly inserted), the - index '-' is always invalid. See example below. + index '-' is always invalid. See the example below. - Throws [`out_of_range.403`](../../home/exceptions.md#jsonexceptionout_of_range403) if the JSON pointer describes a - key of an object which cannot be found. See example below. + key of an object which cannot be found. See the example below. - Throws [`out_of_range.404`](../../home/exceptions.md#jsonexceptionout_of_range404) if the JSON pointer `ptr` can - not be resolved. See example below. + not be resolved. See the example below. ## Complexity diff --git a/docs/mkdocs/docs/api/basic_json/back.md b/docs/mkdocs/docs/api/basic_json/back.md index 1a715284d..b717e16e0 100644 --- a/docs/mkdocs/docs/api/basic_json/back.md +++ b/docs/mkdocs/docs/api/basic_json/back.md @@ -17,8 +17,8 @@ return *tmp; ## Return value -In case of a structured type (array or object), a reference to the last element is returned. In case of number, string, -boolean, or binary values, a reference to the value is returned. +In the case of a structured type (array or object), a reference to the last element is returned. In the case of number, +string, boolean, or binary values, a reference to the value is returned. ## Exception safety diff --git a/docs/mkdocs/docs/api/basic_json/basic_json.md b/docs/mkdocs/docs/api/basic_json/basic_json.md index e2e73612c..71def92a5 100644 --- a/docs/mkdocs/docs/api/basic_json/basic_json.md +++ b/docs/mkdocs/docs/api/basic_json/basic_json.md @@ -99,8 +99,8 @@ basic_json(basic_json&& other) noexcept; 2. C++ has no way of describing mapped types other than to list a list of pairs. As JSON requires that keys must be of type string, rule 2 is the weakest constraint one can pose on initializer lists to interpret them as an object. - 3. In all other cases, the initializer list could not be interpreted as JSON object type, so interpreting it as JSON - array type is safe. + 3. In all other cases, the initializer list could not be interpreted as a JSON object type, so interpreting it as a + JSON array type is safe. With the rules described above, the following JSON values cannot be expressed by an initializer list: @@ -113,7 +113,7 @@ basic_json(basic_json&& other) noexcept; 6. Constructs a JSON array value by creating `cnt` copies of a passed value. In case `cnt` is `0`, an empty array is created. -7. Constructs the JSON value with the contents of the range `[first, last)`. The semantics depends on the different +7. Constructs the JSON value with the contents of the range `[first, last)`. The semantics depend on the different types a JSON value can have: - 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; : the number of JSON copies of `val` to create `first` (in) -: begin of the range to copy from (included) +: the beginning of the range to copy from (included) `last` (in) -: end of the range to copy from (excluded) +: the end of the range to copy from (excluded) `other` (in) : the JSON value to copy/move @@ -188,10 +188,10 @@ basic_json(basic_json&& other) noexcept; 1. Strong guarantee: if an exception is thrown, there are no changes to any JSON value. 2. No-throw guarantee: this constructor never throws exceptions. 3. Depends on the called constructor. For types directly supported by the library (i.e., all types for which no - `to_json()` function was provided), strong guarantee holds: if an exception is thrown, there are no changes to any + `to_json()` function was provided), a strong guarantee holds: if an exception is thrown, there are no changes to any JSON value. 4. Depends on the called constructor. For types directly supported by the library (i.e., all types for which no - `to_json()` function was provided), strong guarantee holds: if an exception is thrown, there are no changes to any + `to_json()` function was provided), a strong guarantee holds: if an exception is thrown, there are no changes to any JSON value. 5. Strong guarantee: if an exception is thrown, there are no changes to any JSON value. 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; `[first, last)` is undefined. - Throws [`invalid_iterator.204`](../../home/exceptions.md#jsonexceptioninvalid_iterator204) if iterators `first` and `last` belong to a primitive type (number, boolean, or string), but `first` does not point to the first - element anymore. In this case, the range `[first, last)` is undefined. See example code below. + element anymore. In this case, the range `[first, last)` is undefined. See the example code below. - Throws [`invalid_iterator.206`](../../home/exceptions.md#jsonexceptioninvalid_iterator206) if iterators `first` and `last` belong to a `#!json null` value. In this case, the range `[first, last)` is undefined. 8. (none) @@ -333,7 +333,7 @@ basic_json(basic_json&& other) noexcept; --8<-- "examples/basic_json__list_init_t.output" ``` -??? example "Example: (6) construct an array with count copies of given value" +??? example "Example: (6) construct an array with count copies of a given value" The following code shows examples for creating arrays with several copies of a given value. diff --git a/docs/mkdocs/docs/api/basic_json/binary.md b/docs/mkdocs/docs/api/basic_json/binary.md index ce45d8a0f..efd4347ca 100644 --- a/docs/mkdocs/docs/api/basic_json/binary.md +++ b/docs/mkdocs/docs/api/basic_json/binary.md @@ -21,7 +21,7 @@ create a value for serialization to those formats. ## Parameters `init` (in) -: container containing bytes to use as binary type +: container containing bytes to use as a binary type `subtype` (in) : 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&& Note, this function exists because of the difficulty in correctly specifying the correct template overload in the standard value ctor, as both JSON arrays and JSON binary arrays are backed with some form of a `std::vector`. Because -JSON binary arrays are a non-standard extension it was decided that it would be best to prevent automatic initialization -of a binary array type, for backwards compatibility and so it does not happen on accident. +JSON binary arrays are a non-standard extension, it was decided that it would be best to prevent automatic +initialization of a binary array type, for backwards compatibility and so it does not happen on accident. ## Examples diff --git a/docs/mkdocs/docs/api/basic_json/binary_t.md b/docs/mkdocs/docs/api/basic_json/binary_t.md index 705c92cb5..902ffe732 100644 --- a/docs/mkdocs/docs/api/basic_json/binary_t.md +++ b/docs/mkdocs/docs/api/basic_json/binary_t.md @@ -56,11 +56,11 @@ type `#!cpp binary_t*` must be dereferenced. - MessagePack - If a subtype is given and the binary array contains exactly 1, 2, 4, 8, or 16 elements, the fixext family (fixext1, fixext2, fixext4, fixext8) is used. For other sizes, the ext family (ext8, ext16, ext32) is used. The subtype is - then added as signed 8-bit integer. + then added as a signed 8-bit integer. - If no subtype is given, the bin family (bin8, bin16, bin32) is used. - BSON - - If a subtype is given, it is used and added as unsigned 8-bit integer. + - If a subtype is given, it is used and added as an unsigned 8-bit integer. - If no subtype is given, the generic binary subtype 0x00 is used. ## Examples @@ -86,4 +86,4 @@ type `#!cpp binary_t*` must be dereferenced. ## Version history -- Added in version 3.8.0. Changed type of subtype to `std::uint64_t` in version 3.10.0. +- Added in version 3.8.0. Changed the type of subtype to `std::uint64_t` in version 3.10.0. diff --git a/docs/mkdocs/docs/api/basic_json/clear.md b/docs/mkdocs/docs/api/basic_json/clear.md index ff04b08e6..427a7fc39 100644 --- a/docs/mkdocs/docs/api/basic_json/clear.md +++ b/docs/mkdocs/docs/api/basic_json/clear.md @@ -33,7 +33,7 @@ Linear in the size of the JSON value. ## Notes -All iterators, pointers and references related to this container are invalidated. +All iterators, pointers, and references related to this container are invalidated. ## Examples diff --git a/docs/mkdocs/docs/api/basic_json/contains.md b/docs/mkdocs/docs/api/basic_json/contains.md index ba2c3df2d..41c376e57 100644 --- a/docs/mkdocs/docs/api/basic_json/contains.md +++ b/docs/mkdocs/docs/api/basic_json/contains.md @@ -35,7 +35,7 @@ bool contains(const json_pointer& ptr) const; ## Return value -1. `#!cpp true` if an element with specified `key` exists. If no such element with such key is found or the JSON value +1. `#!cpp true` if an element with specified `key` exists. If no such element with such a key is found or the JSON value is not an object, `#!cpp false` is returned. 2. See 1. 3. `#!cpp true` if the JSON pointer can be resolved to a stored value, `#!cpp false` otherwise. diff --git a/docs/mkdocs/docs/api/basic_json/dump.md b/docs/mkdocs/docs/api/basic_json/dump.md index 41adb154d..21e22a48c 100644 --- a/docs/mkdocs/docs/api/basic_json/dump.md +++ b/docs/mkdocs/docs/api/basic_json/dump.md @@ -8,7 +8,7 @@ string_t dump(const int indent = -1, ``` Serialization function for JSON values. The function tries to mimic Python's -[`json.dumps()` function](https://docs.python.org/2/library/json.html#json.dump), and currently supports its `indent` +[`json.dumps()` function](https://docs.python.org/2/library/json.html#json.dump), and currently supports its `indent` and `ensure_ascii` parameters. ## Parameters @@ -49,7 +49,7 @@ Linear. ## Notes -Binary values are serialized as object containing two keys: +Binary values are serialized as an object containing two keys: - "bytes": an array of bytes as integers - "subtype": the subtype as integer or `#!json null` if the binary has no subtype diff --git a/docs/mkdocs/docs/api/basic_json/flatten.md b/docs/mkdocs/docs/api/basic_json/flatten.md index 8703e86d1..7b26a8900 100644 --- a/docs/mkdocs/docs/api/basic_json/flatten.md +++ b/docs/mkdocs/docs/api/basic_json/flatten.md @@ -18,7 +18,7 @@ Strong exception safety: if an exception occurs, the original value stays intact ## Complexity -Linear in the size the JSON value. +Linear in the size of the JSON value. ## Notes diff --git a/docs/mkdocs/docs/api/basic_json/from_bjdata.md b/docs/mkdocs/docs/api/basic_json/from_bjdata.md index 3c5eeb351..cef13aea5 100644 --- a/docs/mkdocs/docs/api/basic_json/from_bjdata.md +++ b/docs/mkdocs/docs/api/basic_json/from_bjdata.md @@ -18,7 +18,7 @@ Deserializes a given input to a JSON value using the BJData (Binary JData) seria 1. Reads from a compatible input. 2. Reads from an iterator range. -The exact mapping and its limitations is described on a [dedicated page](../../features/binary_formats/bjdata.md). +The exact mapping and its limitations are described on a [dedicated page](../../features/binary_formats/bjdata.md). ## Template parameters @@ -40,10 +40,10 @@ The exact mapping and its limitations is described on a [dedicated page](../../f : an input in BJData format convertible to an input adapter `first` (in) -: iterator to start of the input +: iterator to the start of the input `last` (in) -: iterator to end of the input +: iterator to the end of the input `strict` (in) : whether to expect the input to be consumed until EOF (`#!cpp true` by default) @@ -63,7 +63,7 @@ Strong guarantee: if an exception is thrown, there are no changes in the JSON va ## Exceptions - Throws [parse_error.110](../../home/exceptions.md#jsonexceptionparse_error110) if the given input ends prematurely or - the end of file was not reached when `strict` was set to true + the end of the file was not reached when `strict` was set to true - Throws [parse_error.112](../../home/exceptions.md#jsonexceptionparse_error112) if a parse error occurs - Throws [parse_error.113](../../home/exceptions.md#jsonexceptionparse_error113) if a string could not be parsed successfully diff --git a/docs/mkdocs/docs/api/basic_json/from_bson.md b/docs/mkdocs/docs/api/basic_json/from_bson.md index 77549370c..fd7d0b097 100644 --- a/docs/mkdocs/docs/api/basic_json/from_bson.md +++ b/docs/mkdocs/docs/api/basic_json/from_bson.md @@ -18,7 +18,7 @@ Deserializes a given input to a JSON value using the BSON (Binary JSON) serializ 1. Reads from a compatible input. 2. Reads from an iterator range. -The exact mapping and its limitations is described on a [dedicated page](../../features/binary_formats/bson.md). +The exact mapping and its limitations are described on a [dedicated page](../../features/binary_formats/bson.md). ## Template parameters @@ -40,10 +40,10 @@ The exact mapping and its limitations is described on a [dedicated page](../../f : an input in BSON format convertible to an input adapter `first` (in) -: iterator to start of the input +: iterator to the start of the input `last` (in) -: iterator to end of the input +: iterator to the end of the input `strict` (in) : whether to expect the input to be consumed until EOF (`#!cpp true` by default) diff --git a/docs/mkdocs/docs/api/basic_json/from_cbor.md b/docs/mkdocs/docs/api/basic_json/from_cbor.md index 3aa57b9ec..c1d1410b4 100644 --- a/docs/mkdocs/docs/api/basic_json/from_cbor.md +++ b/docs/mkdocs/docs/api/basic_json/from_cbor.md @@ -21,7 +21,7 @@ Deserializes a given input to a JSON value using the CBOR (Concise Binary Object 1. Reads from a compatible input. 2. Reads from an iterator range. -The exact mapping and its limitations is described on a [dedicated page](../../features/binary_formats/cbor.md). +The exact mapping and its limitations are described on a [dedicated page](../../features/binary_formats/cbor.md). ## Template parameters @@ -43,10 +43,10 @@ The exact mapping and its limitations is described on a [dedicated page](../../f : an input in CBOR format convertible to an input adapter `first` (in) -: iterator to start of the input +: iterator to the start of the input `last` (in) -: iterator to end of the input +: iterator to the end of the input `strict` (in) : whether to expect the input to be consumed until EOF (`#!cpp true` by default) @@ -70,10 +70,10 @@ Strong guarantee: if an exception is thrown, there are no changes in the JSON va ## Exceptions - Throws [parse_error.110](../../home/exceptions.md#jsonexceptionparse_error110) if the given input ends prematurely or - the end of file was not reached when `strict` was set to true + the end of the file was not reached when `strict` was set to true - Throws [parse_error.112](../../home/exceptions.md#jsonexceptionparse_error112) if unsupported features from CBOR were used in the given input or if the input is not valid CBOR -- Throws [parse_error.113](../../home/exceptions.md#jsonexceptionparse_error113) if a string was expected as map key, +- Throws [parse_error.113](../../home/exceptions.md#jsonexceptionparse_error113) if a string was expected as a map key, but not found ## Complexity diff --git a/docs/mkdocs/docs/api/basic_json/from_msgpack.md b/docs/mkdocs/docs/api/basic_json/from_msgpack.md index 117c3865f..93c3acc5d 100644 --- a/docs/mkdocs/docs/api/basic_json/from_msgpack.md +++ b/docs/mkdocs/docs/api/basic_json/from_msgpack.md @@ -18,7 +18,7 @@ Deserializes a given input to a JSON value using the MessagePack serialization f 1. Reads from a compatible input. 2. Reads from an iterator range. -The exact mapping and its limitations is described on a [dedicated page](../../features/binary_formats/messagepack.md). +The exact mapping and its limitations are described on a [dedicated page](../../features/binary_formats/messagepack.md). ## Template parameters @@ -40,10 +40,10 @@ The exact mapping and its limitations is described on a [dedicated page](../../f : an input in MessagePack format convertible to an input adapter `first` (in) -: iterator to start of the input +: iterator to the start of the input `last` (in) -: iterator to end of the input +: iterator to the end of the input `strict` (in) : whether to expect the input to be consumed until EOF (`#!cpp true` by default) @@ -54,7 +54,7 @@ The exact mapping and its limitations is described on a [dedicated page](../../f ## Return value deserialized JSON value; in case of a parse error and `allow_exceptions` set to `#!cpp false`, the return value will be -`value_t::discarded`. The latter can be checked with [`is_discarded`](is_discarded.md). +`value_t::discarded`. The latter can be checked with [`is_discarded`](is_discarded.md). ## Exception safety @@ -63,10 +63,10 @@ Strong guarantee: if an exception is thrown, there are no changes in the JSON va ## Exceptions - Throws [parse_error.110](../../home/exceptions.md#jsonexceptionparse_error110) if the given input ends prematurely or - the end of file was not reached when `strict` was set to true + the end of the file was not reached when `strict` was set to true - Throws [parse_error.112](../../home/exceptions.md#jsonexceptionparse_error112) if unsupported features from MessagePack were used in the given input or if the input is not valid MessagePack -- Throws [parse_error.113](../../home/exceptions.md#jsonexceptionparse_error113) if a string was expected as map key, +- Throws [parse_error.113](../../home/exceptions.md#jsonexceptionparse_error113) if a string was expected as a map key, but not found ## Complexity diff --git a/docs/mkdocs/docs/api/basic_json/from_ubjson.md b/docs/mkdocs/docs/api/basic_json/from_ubjson.md index 08117e89b..084a2d8bb 100644 --- a/docs/mkdocs/docs/api/basic_json/from_ubjson.md +++ b/docs/mkdocs/docs/api/basic_json/from_ubjson.md @@ -18,7 +18,7 @@ Deserializes a given input to a JSON value using the UBJSON (Universal Binary JS 1. Reads from a compatible input. 2. Reads from an iterator range. -The exact mapping and its limitations is described on a [dedicated page](../../features/binary_formats/ubjson.md). +The exact mapping and its limitations are described on a [dedicated page](../../features/binary_formats/ubjson.md). ## Template parameters @@ -40,10 +40,10 @@ The exact mapping and its limitations is described on a [dedicated page](../../f : an input in UBJSON format convertible to an input adapter `first` (in) -: iterator to start of the input +: iterator to the start of the input `last` (in) -: iterator to end of the input +: iterator to the end of the input `strict` (in) : whether to expect the input to be consumed until EOF (`#!cpp true` by default) @@ -63,7 +63,7 @@ Strong guarantee: if an exception is thrown, there are no changes in the JSON va ## Exceptions - Throws [parse_error.110](../../home/exceptions.md#jsonexceptionparse_error110) if the given input ends prematurely or - the end of file was not reached when `strict` was set to true + the end of the file was not reached when `strict` was set to true - Throws [parse_error.112](../../home/exceptions.md#jsonexceptionparse_error112) if a parse error occurs - Throws [parse_error.113](../../home/exceptions.md#jsonexceptionparse_error113) if a string could not be parsed successfully diff --git a/docs/mkdocs/docs/api/basic_json/front.md b/docs/mkdocs/docs/api/basic_json/front.md index e258c36a0..b5fea1135 100644 --- a/docs/mkdocs/docs/api/basic_json/front.md +++ b/docs/mkdocs/docs/api/basic_json/front.md @@ -10,8 +10,8 @@ Returns a reference to the first element in the container. For a JSON container ## Return value -In case of a structured type (array or object), a reference to the first element is returned. In case of number, string, -boolean, or binary values, a reference to the value is returned. +In the case of a structured type (array or object), a reference to the first element is returned. In the case of number, +string, boolean, or binary values, a reference to the value is returned. ## Exception safety diff --git a/docs/mkdocs/docs/api/basic_json/index.md b/docs/mkdocs/docs/api/basic_json/index.md index 6579a9253..2c942d4db 100644 --- a/docs/mkdocs/docs/api/basic_json/index.md +++ b/docs/mkdocs/docs/api/basic_json/index.md @@ -38,7 +38,7 @@ class basic_json; ## Specializations - [**json**](../json.md) - default specialization -- [**ordered_json**](../ordered_json.md) - specialization that maintains the insertion order of object keys +- [**ordered_json**](../ordered_json.md) - a specialization that maintains the insertion order of object keys ## Iterator invalidation @@ -58,8 +58,8 @@ The class satisfies the following concept requirements: ### Basic -- [DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible): JSON values can be default - constructed. The result will be a JSON null value. +- [DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible): JSON values can be + default-constructed. The result will be a JSON null value. - [MoveConstructible](https://en.cppreference.com/w/cpp/named_req/MoveConstructible): A JSON value can be constructed from an rvalue argument. - [CopyConstructible](https://en.cppreference.com/w/cpp/named_req/CopyConstructible): A JSON value can be @@ -167,19 +167,19 @@ Functions to inspect the type of a JSON value. - [**type**](type.md) - return the type of the JSON value - [**operator value_t**](operator_value_t.md) - return the type of the JSON value - [**type_name**](type_name.md) - return the type as string -- [**is_primitive**](is_primitive.md) - return whether type is primitive -- [**is_structured**](is_structured.md) - return whether type is structured -- [**is_null**](is_null.md) - return whether value is null -- [**is_boolean**](is_boolean.md) - return whether value is a boolean -- [**is_number**](is_number.md) - return whether value is a number -- [**is_number_integer**](is_number_integer.md) - return whether value is an integer number -- [**is_number_unsigned**](is_number_unsigned.md) - return whether value is an unsigned integer number -- [**is_number_float**](is_number_float.md) - return whether value is a floating-point number -- [**is_object**](is_object.md) - return whether value is an object -- [**is_array**](is_array.md) - return whether value is an array -- [**is_string**](is_string.md) - return whether value is a string -- [**is_binary**](is_binary.md) - return whether value is a binary array -- [**is_discarded**](is_discarded.md) - return whether value is discarded +- [**is_primitive**](is_primitive.md) - return whether the type is primitive +- [**is_structured**](is_structured.md) - return whether the type is structured +- [**is_null**](is_null.md) - return whether the value is null +- [**is_boolean**](is_boolean.md) - return whether the value is a boolean +- [**is_number**](is_number.md) - return whether the value is a number +- [**is_number_integer**](is_number_integer.md) - return whether the value is an integer number +- [**is_number_unsigned**](is_number_unsigned.md) - return whether the value is an unsigned integer number +- [**is_number_float**](is_number_float.md) - return whether the value is a floating-point number +- [**is_object**](is_object.md) - return whether the value is an object +- [**is_array**](is_array.md) - return whether the value is an array +- [**is_string**](is_string.md) - return whether the value is a string +- [**is_binary**](is_binary.md) - return whether the value is a binary array +- [**is_discarded**](is_discarded.md) - return whether the value is discarded Optional functions to access the [diagnostic positions](../macros/json_diagnostic_positions.md). @@ -237,7 +237,7 @@ Access to the JSON value - [**push_back**](push_back.md) - add a value to an array/object - [**operator+=**](operator+=.md) - add a value to an array/object - [**emplace_back**](emplace_back.md) - add a value to an array -- [**emplace**](emplace.md) - add a value to an object if key does not exist +- [**emplace**](emplace.md) - add a value to an object if a key does not exist - [**erase**](erase.md) - remove elements - [**insert**](insert.md) - inserts elements - [**update**](update.md) - updates a JSON object from another object, overwriting existing keys diff --git a/docs/mkdocs/docs/api/basic_json/insert.md b/docs/mkdocs/docs/api/basic_json/insert.md index b92604887..2f809f015 100644 --- a/docs/mkdocs/docs/api/basic_json/insert.md +++ b/docs/mkdocs/docs/api/basic_json/insert.md @@ -18,11 +18,11 @@ iterator insert(const_iterator pos, initializer_list_t ilist); void insert(const_iterator first, const_iterator last); ``` -1. Inserts element `val` into array before iterator `pos`. -2. Inserts `cnt` copies of `val` into array before iterator `pos`. -3. Inserts elements from range `[first, last)` into array before iterator `pos`. -4. Inserts elements from initializer list `ilist` into array before iterator `pos`. -5. Inserts elements from range `[first, last)` into object. +1. Inserts element `val` into an array before iterator `pos`. +2. Inserts `cnt` copies of `val` into an array before iterator `pos`. +3. Inserts elements from range `[first, last)` into an array before iterator `pos`. +4. Inserts elements from initializer list `ilist` into an array before iterator `pos`. +5. Inserts elements from range `[first, last)` into an object. ## Iterator invalidation @@ -47,10 +47,10 @@ the same index which is now a different value. : number of copies of `val` to insert `first` (in) -: begin of the range of elements to insert +: the start of the range of elements to insert `last` (in) -: end of the range of elements to insert +: the end of the range of elements to insert `ilist` (in) : initializer list to insert the values from @@ -139,7 +139,7 @@ Strong exception safety: if an exception occurs, the original value stays intact --8<-- "examples/insert__count.output" ``` -??? example "Example (3): insert range of elements into array" +??? example "Example (3): insert a range of elements into an array" The example shows how `insert()` is used. @@ -153,7 +153,7 @@ Strong exception safety: if an exception occurs, the original value stays intact --8<-- "examples/insert__range.output" ``` -??? example "Example (4): insert elements from initializer list into array" +??? example "Example (4): insert elements from an initializer list into an array" The example shows how `insert()` is used. @@ -167,7 +167,7 @@ Strong exception safety: if an exception occurs, the original value stays intact --8<-- "examples/insert__ilist.output" ``` -??? example "Example (5): insert range of elements into object" +??? example "Example (5): insert a range of elements into an object" The example shows how `insert()` is used. diff --git a/docs/mkdocs/docs/api/basic_json/is_binary.md b/docs/mkdocs/docs/api/basic_json/is_binary.md index ea48d745c..2a42e5edf 100644 --- a/docs/mkdocs/docs/api/basic_json/is_binary.md +++ b/docs/mkdocs/docs/api/basic_json/is_binary.md @@ -4,7 +4,7 @@ constexpr bool is_binary() const noexcept; ``` -This function returns `#!cpp true` if and only if the JSON value is binary array. +This function returns `#!cpp true` if and only if the JSON value is a binary array. ## Return value diff --git a/docs/mkdocs/docs/api/basic_json/is_number.md b/docs/mkdocs/docs/api/basic_json/is_number.md index 9807911bc..2f6d63565 100644 --- a/docs/mkdocs/docs/api/basic_json/is_number.md +++ b/docs/mkdocs/docs/api/basic_json/is_number.md @@ -9,7 +9,7 @@ unsigned) and floating-point values. ## Return value -`#!cpp true` if type is number (regardless whether integer, unsigned integer or floating-type), `#!cpp false` otherwise. +`#!cpp true` if type is number (regardless whether integer, unsigned integer, or floating-type), `#!cpp false` otherwise. ## Exception safety @@ -46,9 +46,9 @@ constexpr bool is_number() const noexcept ## See also -- [is_number_integer()](is_number_integer.md) check if value is an integer or unsigned integer number -- [is_number_unsigned()](is_number_unsigned.md) check if value is an unsigned integer number -- [is_number_float()](is_number_float.md) check if value is a floating-point number +- [is_number_integer()](is_number_integer.md) check if the value is an integer or unsigned integer number +- [is_number_unsigned()](is_number_unsigned.md) check if the value is an unsigned integer number +- [is_number_float()](is_number_float.md) check if the value is a floating-point number ## Version history diff --git a/docs/mkdocs/docs/api/basic_json/is_number_float.md b/docs/mkdocs/docs/api/basic_json/is_number_float.md index 68d0cfb01..ad18858e3 100644 --- a/docs/mkdocs/docs/api/basic_json/is_number_float.md +++ b/docs/mkdocs/docs/api/basic_json/is_number_float.md @@ -37,9 +37,9 @@ Constant. ## See also -- [is_number()](is_number.md) check if value is a number -- [is_number_integer()](is_number_integer.md) check if value is an integer or unsigned integer number -- [is_number_unsigned()](is_number_unsigned.md) check if value is an unsigned integer number +- [is_number()](is_number.md) check if the value is a number +- [is_number_integer()](is_number_integer.md) check if the value is an integer or unsigned integer number +- [is_number_unsigned()](is_number_unsigned.md) check if the value is an unsigned integer number ## Version history diff --git a/docs/mkdocs/docs/api/basic_json/is_number_integer.md b/docs/mkdocs/docs/api/basic_json/is_number_integer.md index 8ca214aed..b8f971bd6 100644 --- a/docs/mkdocs/docs/api/basic_json/is_number_integer.md +++ b/docs/mkdocs/docs/api/basic_json/is_number_integer.md @@ -37,9 +37,9 @@ Constant. ## See also -- [is_number()](is_number.md) check if value is a number -- [is_number_unsigned()](is_number_unsigned.md) check if value is an unsigned integer number -- [is_number_float()](is_number_float.md) check if value is a floating-point number +- [is_number()](is_number.md) check if the value is a number +- [is_number_unsigned()](is_number_unsigned.md) check if the value is an unsigned integer number +- [is_number_float()](is_number_float.md) check if the value is a floating-point number ## Version history diff --git a/docs/mkdocs/docs/api/basic_json/is_number_unsigned.md b/docs/mkdocs/docs/api/basic_json/is_number_unsigned.md index 2ac98a5f0..50083164e 100644 --- a/docs/mkdocs/docs/api/basic_json/is_number_unsigned.md +++ b/docs/mkdocs/docs/api/basic_json/is_number_unsigned.md @@ -37,9 +37,9 @@ Constant. ## See also -- [is_number()](is_number.md) check if value is a number -- [is_number_integer()](is_number_integer.md) check if value is an integer or unsigned integer number -- [is_number_float()](is_number_float.md) check if value is a floating-point number +- [is_number()](is_number.md) check if the value is a number +- [is_number_integer()](is_number_integer.md) check if the value is an integer or unsigned integer number +- [is_number_float()](is_number_float.md) check if the value is a floating-point number ## Version history diff --git a/docs/mkdocs/docs/api/basic_json/is_primitive.md b/docs/mkdocs/docs/api/basic_json/is_primitive.md index cf6cbbd4c..076c2bfef 100644 --- a/docs/mkdocs/docs/api/basic_json/is_primitive.md +++ b/docs/mkdocs/docs/api/basic_json/is_primitive.md @@ -35,7 +35,7 @@ The term *primitive* stems from [RFC 8259](https://tools.ietf.org/html/rfc8259): > JSON can represent four primitive types (strings, numbers, booleans, and null) and two structured types (objects and > arrays). -This library extends primitive types to binary types, because binary types are roughly comparable to strings. Hence, +This library extends primitive types to binary types, because binary types are roughly comparable to strings. Hence, `is_primitive()` returns `#!cpp true` for binary values. ## Examples @@ -56,12 +56,12 @@ This library extends primitive types to binary types, because binary types are ## See also -- [is_structured()](is_structured.md) returns whether JSON value is structured -- [is_null()](is_null.md) returns whether JSON value is `null` -- [is_string()](is_string.md) returns whether JSON value is a string -- [is_boolean()](is_boolean.md) returns whether JSON value is a boolean -- [is_number()](is_number.md) returns whether JSON value is a number -- [is_binary()](is_binary.md) returns whether JSON value is a binary array +- [is_structured()](is_structured.md) returns whether the JSON value is structured +- [is_null()](is_null.md) returns whether the JSON value is `null` +- [is_string()](is_string.md) returns whether the JSON value is a string +- [is_boolean()](is_boolean.md) returns whether the JSON value is a boolean +- [is_number()](is_number.md) returns whether the JSON value is a number +- [is_binary()](is_binary.md) returns whether the JSON value is a binary array ## Version history diff --git a/docs/mkdocs/docs/api/basic_json/is_structured.md b/docs/mkdocs/docs/api/basic_json/is_structured.md index ecca80d8d..f2d9e79ff 100644 --- a/docs/mkdocs/docs/api/basic_json/is_structured.md +++ b/docs/mkdocs/docs/api/basic_json/is_structured.md @@ -55,8 +55,8 @@ Note that though strings are containers in C++, they are treated as primitive va ## See also - [is_primitive()](is_primitive.md) returns whether JSON value is primitive -- [is_array()](is_array.md) returns whether value is an array -- [is_object()](is_object.md) returns whether value is an object +- [is_array()](is_array.md) returns whether the value is an array +- [is_object()](is_object.md) returns whether the value is an object ## Version history diff --git a/docs/mkdocs/docs/api/basic_json/number_float_t.md b/docs/mkdocs/docs/api/basic_json/number_float_t.md index 50aa43b48..3e8933da6 100644 --- a/docs/mkdocs/docs/api/basic_json/number_float_t.md +++ b/docs/mkdocs/docs/api/basic_json/number_float_t.md @@ -13,7 +13,7 @@ The type used to store JSON numbers (floating-point). > cannot be represented in the grammar below (such as Infinity and NaN) are not permitted. This description includes both integer and floating-point numbers. However, C++ allows more precise storage if it is -known whether the number is a signed integer, an unsigned integer or a floating-point number. Therefore, three different +known whether the number is a signed integer, an unsigned integer, or a floating-point number. Therefore, three different types, [`number_integer_t`](number_integer_t.md), [`number_unsigned_t`](number_unsigned_t.md) and `number_float_t` are used. @@ -28,9 +28,9 @@ With the default values for `NumberFloatType` (`double`), the default value for #### Default behavior -- The restrictions about leading zeros is not enforced in C++. Instead, leading zeros in floating-point literals will be - ignored. Internally, the value will be stored as decimal number. For instance, the C++ floating-point literal `01.2` - will be serialized to `1.2`. During deserialization, leading zeros yield an error. +- The restrictions about leading zeros are not enforced in C++. Instead, leading zeros in floating-point literals will + be ignored. Internally, the value will be stored as a decimal number. For instance, the C++ floating-point literal + `01.2` will be serialized to `1.2`. During deserialization, leading zeros yield an error. - Not-a-number (NaN) values will be serialized to `null`. #### Limits diff --git a/docs/mkdocs/docs/api/basic_json/number_integer_t.md b/docs/mkdocs/docs/api/basic_json/number_integer_t.md index 9bb3835a0..cef3f2001 100644 --- a/docs/mkdocs/docs/api/basic_json/number_integer_t.md +++ b/docs/mkdocs/docs/api/basic_json/number_integer_t.md @@ -13,7 +13,7 @@ The type used to store JSON numbers (integers). > cannot be represented in the grammar below (such as Infinity and NaN) are not permitted. This description includes both integer and floating-point numbers. However, C++ allows more precise storage if it is -known whether the number is a signed integer, an unsigned integer or a floating-point number. Therefore, three different +known whether the number is a signed integer, an unsigned integer, or a floating-point number. Therefore, three different types, `number_integer_t`, [`number_unsigned_t`](number_unsigned_t.md) and [`number_float_t`](number_float_t.md) are used. @@ -29,9 +29,9 @@ With the default values for `NumberIntegerType` (`std::int64_t`), the default va #### Default behavior -- The restrictions about leading zeros is not enforced in C++. Instead, leading zeros in integer literals lead to an - interpretation as octal number. Internally, the value will be stored as decimal number. For instance, the C++ integer - literal `010` will be serialized to `8`. During deserialization, leading zeros yield an error. +- The restrictions about leading zeros are not enforced in C++. Instead, leading zeros in integer literals lead to an + interpretation as an octal number. Internally, the value will be stored as a decimal number. For instance, the C++ + integer literal `010` will be serialized to `8`. During deserialization, leading zeros yield an error. - Not-a-number (NaN) values will be serialized to `null`. #### Limits @@ -42,7 +42,7 @@ With the default values for `NumberIntegerType` (`std::int64_t`), the default va When the default type is used, the maximal integer number that can be stored is `9223372036854775807` (INT64_MAX) and the minimal integer number that can be stored is `-9223372036854775808` (INT64_MIN). Integer numbers that are out of range will yield over/underflow when used in a constructor. During deserialization, too large or small integer numbers -will be automatically be stored as [`number_unsigned_t`](number_unsigned_t.md) or [`number_float_t`](number_float_t.md). +will automatically be stored as [`number_unsigned_t`](number_unsigned_t.md) or [`number_float_t`](number_float_t.md). [RFC 8259](https://tools.ietf.org/html/rfc8259) further states: > Note that when such software is used, numbers that are integers and are in the range $[-2^{53}+1, 2^{53}-1]$ are diff --git a/docs/mkdocs/docs/api/basic_json/number_unsigned_t.md b/docs/mkdocs/docs/api/basic_json/number_unsigned_t.md index 8a1540a57..79b1c486c 100644 --- a/docs/mkdocs/docs/api/basic_json/number_unsigned_t.md +++ b/docs/mkdocs/docs/api/basic_json/number_unsigned_t.md @@ -13,7 +13,7 @@ The type used to store JSON numbers (unsigned). > cannot be represented in the grammar below (such as Infinity and NaN) are not permitted. This description includes both integer and floating-point numbers. However, C++ allows more precise storage if it is -known whether the number is a signed integer, an unsigned integer or a floating-point number. Therefore, three different +known whether the number is a signed integer, an unsigned integer, or a floating-point number. Therefore, three different types, [`number_integer_t`](number_integer_t.md), `number_unsigned_t` and [`number_float_t`](number_float_t.md) are used. @@ -29,9 +29,9 @@ With the default values for `NumberUnsignedType` (`std::uint64_t`), the default #### Default behavior -- The restrictions about leading zeros is not enforced in C++. Instead, leading zeros in integer literals lead to an - interpretation as octal number. Internally, the value will be stored as decimal number. For instance, the C++ integer - literal `010` will be serialized to `8`. During deserialization, leading zeros yield an error. +- The restrictions about leading zeros are not enforced in C++. Instead, leading zeros in integer literals lead to an + interpretation as an octal number. Internally, the value will be stored as a decimal number. For instance, the C++ + integer literal `010` will be serialized to `8`. During deserialization, leading zeros yield an error. - Not-a-number (NaN) values will be serialized to `null`. #### Limits @@ -41,7 +41,7 @@ With the default values for `NumberUnsignedType` (`std::uint64_t`), the default When the default type is used, the maximal integer number that can be stored is `18446744073709551615` (UINT64_MAX) and the minimal integer number that can be stored is `0`. Integer numbers that are out of range will yield over/underflow -when used in a constructor. During deserialization, too large or small integer numbers will be automatically be stored +when used in a constructor. During deserialization, too large or small integer numbers will automatically be stored as [`number_integer_t`](number_integer_t.md) or [`number_float_t`](number_float_t.md). [RFC 8259](https://tools.ietf.org/html/rfc8259) further states: diff --git a/docs/mkdocs/docs/api/basic_json/object.md b/docs/mkdocs/docs/api/basic_json/object.md index 9bdbddb6a..73fbcaf79 100644 --- a/docs/mkdocs/docs/api/basic_json/object.md +++ b/docs/mkdocs/docs/api/basic_json/object.md @@ -25,7 +25,7 @@ Strong guarantee: if an exception is thrown, there are no changes in the JSON va Throws [`type_error.301`](../../home/exceptions.md#jsonexceptiontype_error301) if `init` is not a list of pairs whose first elements are strings. In this case, no object can be created. When such a value is passed to `basic_json(initializer_list_t, bool, value_t)`, an array would have been created from the passed initializer list -`init`. See example below. +`init`. See the example below. ## Complexity @@ -34,7 +34,7 @@ Linear in the size of `init`. ## Notes This function is only added for symmetry reasons. In contrast to the related function `array(initializer_list_t)`, there -are no cases which can only be expressed by this function. That is, any initializer list `init` can also be passed to +are no cases that can only be expressed by this function. That is, any initializer list `init` can also be passed to the initializer list constructor `basic_json(initializer_list_t, bool, value_t)`. ## Examples diff --git a/docs/mkdocs/docs/api/basic_json/object_t.md b/docs/mkdocs/docs/api/basic_json/object_t.md index 39f68b089..7dda42d2b 100644 --- a/docs/mkdocs/docs/api/basic_json/object_t.md +++ b/docs/mkdocs/docs/api/basic_json/object_t.md @@ -87,8 +87,8 @@ Objects are stored as pointers in a `basic_json` type. That is, for any access t #### Object key order -The order name/value pairs are added to the object is *not* preserved by the library. Therefore, iterating an object may -return name/value pairs in a different order than they were originally stored. In fact, keys will be traversed in +The order name/value pairs are added to the object are *not* preserved by the library. Therefore, iterating an object +may return name/value pairs in a different order than they were originally stored. In fact, keys will be traversed in alphabetical order as `std::map` with `std::less` is used by default. Please note this behavior conforms to [RFC 8259](https://tools.ietf.org/html/rfc8259), because any order implements the specified "unordered" nature of JSON objects. diff --git a/docs/mkdocs/docs/api/basic_json/operator+=.md b/docs/mkdocs/docs/api/basic_json/operator+=.md index 1591007f6..473b82a4e 100644 --- a/docs/mkdocs/docs/api/basic_json/operator+=.md +++ b/docs/mkdocs/docs/api/basic_json/operator+=.md @@ -121,4 +121,4 @@ interpreted as `object_t::value_type` or `std::initializer_list`, se 1. Since version 1.0.0. 2. Since version 1.0.0. -2. Since version 2.0.0. +3. Since version 2.0.0. diff --git a/docs/mkdocs/docs/api/basic_json/operator_le.md b/docs/mkdocs/docs/api/basic_json/operator_le.md index c6144bb45..9dfa4e1e0 100644 --- a/docs/mkdocs/docs/api/basic_json/operator_le.md +++ b/docs/mkdocs/docs/api/basic_json/operator_le.md @@ -17,7 +17,7 @@ bool operator<=(ScalarType lhs, const const_reference rhs) noexcept; // (2) operand is `NaN` and the other operand is either `NaN` or any other number. - Otherwise, returns the result of `#!cpp !(rhs < lhs)` (see [**operator<**](operator_lt.md)). -1. Compares whether a JSON value is less than or equal to a scalar or a scalar is less than or equal +2. Compares whether a JSON value is less than or equal to a scalar or a scalar is less than or equal to a JSON value by converting the scalar to a JSON value and comparing both JSON values according to 1. diff --git a/docs/mkdocs/docs/api/basic_json/out_of_range.md b/docs/mkdocs/docs/api/basic_json/out_of_range.md index 0c2164116..3b6178999 100644 --- a/docs/mkdocs/docs/api/basic_json/out_of_range.md +++ b/docs/mkdocs/docs/api/basic_json/out_of_range.md @@ -5,7 +5,7 @@ class out_of_range : public exception; ``` This exception is thrown in case a library function is called on an input parameter that exceeds the expected range, for -instance in case of array indices or nonexisting object keys. +instance, in the case of array indices or nonexisting object keys. Exceptions have ids 4xx (see [list of out-of-range errors](../../home/exceptions.md#out-of-range)). diff --git a/docs/mkdocs/docs/api/basic_json/parse.md b/docs/mkdocs/docs/api/basic_json/parse.md index 69d412f97..140a08f3d 100644 --- a/docs/mkdocs/docs/api/basic_json/parse.md +++ b/docs/mkdocs/docs/api/basic_json/parse.md @@ -19,8 +19,8 @@ static basic_json parse(IteratorType first, IteratorType last, 1. Deserialize from a compatible input. 2. Deserialize from a pair of character iterators - The `value_type` of the iterator must be an integral type with size of 1, 2 or 4 bytes, which will be interpreted - respectively as UTF-8, UTF-16 and UTF-32. + The `value_type` of the iterator must be an integral type with size of 1, 2, or 4 bytes, which will be interpreted + respectively as UTF-8, UTF-16, and UTF-32. ## Template parameters @@ -57,10 +57,10 @@ static basic_json parse(IteratorType first, IteratorType last, (`#!cpp false`); (optional, `#!cpp false` by default) `first` (in) -: iterator to start of character range +: iterator to the start of a character range `last` (in) -: iterator to end of character range +: iterator to the end of a character range ## Return value @@ -147,7 +147,7 @@ A UTF-8 byte order mark is silently ignored. --8<-- "examples/parse__contiguouscontainer__parser_callback_t.output" ``` -??? example "Parsing from a non null-terminated string" +??? example "Parsing from a non-null-terminated string" The example below demonstrates the `parse()` function reading from a string that is not null-terminated. @@ -199,7 +199,7 @@ A UTF-8 byte order mark is silently ignored. - Added in version 1.0.0. - Overload for contiguous containers (1) added in version 2.0.3. - Ignoring comments via `ignore_comments` added in version 3.9.0. -- Changed [runtime assertion](../../features/assertions.md) in case of `FILE*` null pointers to exception in version 3.11.4. +- Changed [runtime assertion](../../features/assertions.md) in case of `FILE*` null pointers to exception in version 3.12.0. !!! warning "Deprecation" diff --git a/docs/mkdocs/docs/api/basic_json/parse_error.md b/docs/mkdocs/docs/api/basic_json/parse_error.md index 87b54b4c1..93986e543 100644 --- a/docs/mkdocs/docs/api/basic_json/parse_error.md +++ b/docs/mkdocs/docs/api/basic_json/parse_error.md @@ -4,7 +4,7 @@ class parse_error : public exception; ``` -This exception is thrown by the library when a parse error occurs. Parse errors can occur during the deserialization of +The library throws this exception when a parse error occurs. Parse errors can occur during the deserialization of JSON text, BSON, CBOR, MessagePack, UBJSON, as well as when using JSON Patch. Member `byte` holds the byte index of the last read character in the input file (see note below). diff --git a/docs/mkdocs/docs/api/basic_json/patch.md b/docs/mkdocs/docs/api/basic_json/patch.md index deec47434..0f6387a69 100644 --- a/docs/mkdocs/docs/api/basic_json/patch.md +++ b/docs/mkdocs/docs/api/basic_json/patch.md @@ -37,8 +37,8 @@ Strong guarantee: if an exception is thrown, there are no changes in the JSON va ## Complexity -Linear in the size of the JSON value and the length of the JSON patch. As usually only a fraction of the JSON value is -affected by the patch, the complexity can usually be neglected. +Linear in the size of the JSON value and the length of the JSON patch. As usually the patch affects only a fraction of +the JSON value, the complexity can usually be neglected. ## Notes diff --git a/docs/mkdocs/docs/api/basic_json/patch_inplace.md b/docs/mkdocs/docs/api/basic_json/patch_inplace.md index e8fd176c3..6cc13e102 100644 --- a/docs/mkdocs/docs/api/basic_json/patch_inplace.md +++ b/docs/mkdocs/docs/api/basic_json/patch_inplace.md @@ -33,8 +33,8 @@ No guarantees, value may be corrupted by an unsuccessful patch operation. ## Complexity -Linear in the size of the JSON value and the length of the JSON patch. As usually only a fraction of the JSON value is -affected by the patch, the complexity can usually be neglected. +Linear in the size of the JSON value and the length of the JSON patch. As usually the patch affects only a fraction of +the JSON value, the complexity can usually be neglected. ## Notes diff --git a/docs/mkdocs/docs/api/basic_json/push_back.md b/docs/mkdocs/docs/api/basic_json/push_back.md index e06103930..49f185c56 100644 --- a/docs/mkdocs/docs/api/basic_json/push_back.md +++ b/docs/mkdocs/docs/api/basic_json/push_back.md @@ -117,4 +117,4 @@ All functions can throw the following exception: 1. Since version 1.0.0. 2. Since version 1.0.0. -2. Since version 2.0.0. +3. Since version 2.0.0. diff --git a/docs/mkdocs/docs/api/basic_json/sax_parse.md b/docs/mkdocs/docs/api/basic_json/sax_parse.md index e2ac1b41d..43793d09a 100644 --- a/docs/mkdocs/docs/api/basic_json/sax_parse.md +++ b/docs/mkdocs/docs/api/basic_json/sax_parse.md @@ -23,8 +23,8 @@ Read from input and generate SAX events 1. Read from a compatible input. 2. Read from a pair of character iterators - The value_type of the iterator must be an integral type with size of 1, 2 or 4 bytes, which will be interpreted - respectively as UTF-8, UTF-16 and UTF-32. + The value_type of the iterator must be an integral type with a size of 1, 2, or 4 bytes, which will be interpreted + respectively as UTF-8, UTF-16, and UTF-32. The SAX event lister must follow the interface of [`json_sax`](../json_sax/index.md). @@ -66,10 +66,10 @@ The SAX event lister must follow the interface of [`json_sax`](../json_sax/index (`#!cpp false`); (optional, `#!cpp false` by default) `first` (in) -: iterator to start of character range +: iterator to the start of a character range `last` (in) -: iterator to end of character range +: iterator to the end of a character range ## Return value diff --git a/docs/mkdocs/docs/api/basic_json/to_bjdata.md b/docs/mkdocs/docs/api/basic_json/to_bjdata.md index 27c7175f5..7aa331d02 100644 --- a/docs/mkdocs/docs/api/basic_json/to_bjdata.md +++ b/docs/mkdocs/docs/api/basic_json/to_bjdata.md @@ -22,7 +22,7 @@ be more compact than JSON itself, yet more efficient to parse. 1. Returns a byte vector containing the BJData serialization. 2. Writes the BJData serialization to an output adapter. -The exact mapping and its limitations is described on a [dedicated page](../../features/binary_formats/bjdata.md). +The exact mapping and its limitations are described on a [dedicated page](../../features/binary_formats/bjdata.md). ## Parameters diff --git a/docs/mkdocs/docs/api/basic_json/to_bson.md b/docs/mkdocs/docs/api/basic_json/to_bson.md index 5c4324a3f..d0cae0ea3 100644 --- a/docs/mkdocs/docs/api/basic_json/to_bson.md +++ b/docs/mkdocs/docs/api/basic_json/to_bson.md @@ -15,7 +15,7 @@ so-called document). 1. Returns a byte vector containing the BSON serialization. 2. Writes the BSON serialization to an output adapter. -The exact mapping and its limitations is described on a [dedicated page](../../features/binary_formats/bson.md). +The exact mapping and its limitations are described on a [dedicated page](../../features/binary_formats/bson.md). ## Parameters @@ -27,7 +27,7 @@ The exact mapping and its limitations is described on a [dedicated page](../../f ## Return value -1. BSON serialization as byte vector +1. BSON serialization as a byte vector 2. (none) ## Exception safety diff --git a/docs/mkdocs/docs/api/basic_json/to_cbor.md b/docs/mkdocs/docs/api/basic_json/to_cbor.md index 0f944c481..81d66467b 100644 --- a/docs/mkdocs/docs/api/basic_json/to_cbor.md +++ b/docs/mkdocs/docs/api/basic_json/to_cbor.md @@ -10,13 +10,13 @@ static void to_cbor(const basic_json& j, detail::output_adapter o); ``` Serializes a given JSON value `j` to a byte vector using the CBOR (Concise Binary Object Representation) serialization -format. CBOR is a binary serialization format which aims to be more compact than JSON itself, yet more efficient to +format. CBOR is a binary serialization format that aims to be more compact than JSON itself, yet more efficient to parse. 1. Returns a byte vector containing the CBOR serialization. 2. Writes the CBOR serialization to an output adapter. -The exact mapping and its limitations is described on a [dedicated page](../../features/binary_formats/cbor.md). +The exact mapping and its limitations are described on a [dedicated page](../../features/binary_formats/cbor.md). ## Parameters @@ -28,7 +28,7 @@ The exact mapping and its limitations is described on a [dedicated page](../../f ## Return value -1. CBOR serialization as byte vector +1. CBOR serialization as a byte vector 2. (none) ## Exception safety diff --git a/docs/mkdocs/docs/api/basic_json/to_msgpack.md b/docs/mkdocs/docs/api/basic_json/to_msgpack.md index 7d40981d5..3ae43a049 100644 --- a/docs/mkdocs/docs/api/basic_json/to_msgpack.md +++ b/docs/mkdocs/docs/api/basic_json/to_msgpack.md @@ -10,12 +10,12 @@ static void to_msgpack(const basic_json& j, detail::output_adapter o); ``` Serializes a given JSON value `j` to a byte vector using the MessagePack serialization format. MessagePack is a binary -serialization format which aims to be more compact than JSON itself, yet more efficient to parse. +serialization format that aims to be more compact than JSON itself, yet more efficient to parse. 1. Returns a byte vector containing the MessagePack serialization. 2. Writes the MessagePack serialization to an output adapter. -The exact mapping and its limitations is described on a [dedicated page](../../features/binary_formats/messagepack.md). +The exact mapping and its limitations are described on a [dedicated page](../../features/binary_formats/messagepack.md). ## Parameters @@ -27,7 +27,7 @@ The exact mapping and its limitations is described on a [dedicated page](../../f ## Return value -1. MessagePack serialization as byte vector +1. MessagePack serialization as a byte vector 2. (none) ## Exception safety diff --git a/docs/mkdocs/docs/api/basic_json/to_ubjson.md b/docs/mkdocs/docs/api/basic_json/to_ubjson.md index e3cd5d62b..a27280314 100644 --- a/docs/mkdocs/docs/api/basic_json/to_ubjson.md +++ b/docs/mkdocs/docs/api/basic_json/to_ubjson.md @@ -19,7 +19,7 @@ aims to be more compact than JSON itself, yet more efficient to parse. 1. Returns a byte vector containing the UBJSON serialization. 2. Writes the UBJSON serialization to an output adapter. -The exact mapping and its limitations is described on a [dedicated page](../../features/binary_formats/ubjson.md). +The exact mapping and its limitations are described on a [dedicated page](../../features/binary_formats/ubjson.md). ## Parameters @@ -38,7 +38,7 @@ The exact mapping and its limitations is described on a [dedicated page](../../f ## Return value -1. UBJSON serialization as byte vector +1. UBJSON serialization as a byte vector 2. (none) ## Exception safety diff --git a/docs/mkdocs/docs/api/basic_json/unflatten.md b/docs/mkdocs/docs/api/basic_json/unflatten.md index d9778036c..5585cbc31 100644 --- a/docs/mkdocs/docs/api/basic_json/unflatten.md +++ b/docs/mkdocs/docs/api/basic_json/unflatten.md @@ -28,11 +28,11 @@ The function can throw the following exceptions: ## Complexity -Linear in the size the JSON value. +Linear in the size of the JSON value. ## Notes -Empty objects and arrays are flattened by [`flatten()`](flatten.md) to `#!json null` values and can not unflattened to +Empty objects and arrays are flattened by [`flatten()`](flatten.md) to `#!json null` values and cannot unflattened to their original type. Apart from this example, for a JSON value `j`, the following is always true: `#!cpp j == j.flatten().unflatten()`. diff --git a/docs/mkdocs/docs/api/basic_json/update.md b/docs/mkdocs/docs/api/basic_json/update.md index bfe785d74..267a70517 100644 --- a/docs/mkdocs/docs/api/basic_json/update.md +++ b/docs/mkdocs/docs/api/basic_json/update.md @@ -32,10 +32,10 @@ iterators (including the `end()` iterator) and all references to the elements ar `#!c false`) `first` (in) -: begin of the range of elements to insert +: the beginning of the range of elements to insert `last` (in) -: end of the range of elements to insert +: the end of the range of elements to insert ## Exceptions diff --git a/docs/mkdocs/docs/api/byte_container_with_subtype/byte_container_with_subtype.md b/docs/mkdocs/docs/api/byte_container_with_subtype/byte_container_with_subtype.md index 9913a9b5c..c8e47cfa3 100644 --- a/docs/mkdocs/docs/api/byte_container_with_subtype/byte_container_with_subtype.md +++ b/docs/mkdocs/docs/api/byte_container_with_subtype/byte_container_with_subtype.md @@ -13,9 +13,9 @@ byte_container_with_subtype(const container_type& container, subtype_type subtyp byte_container_with_subtype(container_type&& container, subtype_type subtype); ``` -1. Create empty binary container without subtype. -2. Create binary container without subtype. -3. Create binary container with subtype. +1. Create an empty binary container without a subtype. +2. Create a binary container without a subtype. +3. Create a binary container with a subtype. ## Parameters diff --git a/docs/mkdocs/docs/api/byte_container_with_subtype/clear_subtype.md b/docs/mkdocs/docs/api/byte_container_with_subtype/clear_subtype.md index c62dead36..f4bb891ee 100644 --- a/docs/mkdocs/docs/api/byte_container_with_subtype/clear_subtype.md +++ b/docs/mkdocs/docs/api/byte_container_with_subtype/clear_subtype.md @@ -5,7 +5,7 @@ void clear_subtype() noexcept; ``` Clears the binary subtype and flags the value as not having a subtype, which has implications for serialization; for -instance MessagePack will prefer the bin family over the ext family. +instance, MessagePack will prefer the bin family over the ext family. ## Exception safety diff --git a/docs/mkdocs/docs/api/byte_container_with_subtype/index.md b/docs/mkdocs/docs/api/byte_container_with_subtype/index.md index 277fffa34..85c09079b 100644 --- a/docs/mkdocs/docs/api/byte_container_with_subtype/index.md +++ b/docs/mkdocs/docs/api/byte_container_with_subtype/index.md @@ -7,7 +7,7 @@ class byte_container_with_subtype : public BinaryType; This type extends the template parameter `BinaryType` provided to [`basic_json`](../basic_json/index.md) with a subtype used by BSON and MessagePack. This type exists so that the user does not have to specify a type themselves with a -specific naming scheme in order to override the binary type. +specific naming scheme in order to override the binary type. ## Template parameters @@ -32,4 +32,4 @@ specific naming scheme in order to override the binary type. ## Version history - Added in version 3.8.0. -- Changed type of subtypes to `#!cpp std::uint64_t` in 3.10.0. +- Changed the type of subtypes to `#!cpp std::uint64_t` in 3.10.0. diff --git a/docs/mkdocs/docs/api/json_pointer/back.md b/docs/mkdocs/docs/api/json_pointer/back.md index 240bc6e1e..7b798e368 100644 --- a/docs/mkdocs/docs/api/json_pointer/back.md +++ b/docs/mkdocs/docs/api/json_pointer/back.md @@ -4,7 +4,7 @@ const string_t& back() const; ``` -Return last reference token. +Return the last reference token. ## Return value @@ -12,7 +12,7 @@ Last reference token. ## Exceptions -Throws [out_of_range.405](../../home/exceptions.md#jsonexceptionout_of_range405) if JSON pointer has no parent. +Throws [out_of_range.405](../../home/exceptions.md#jsonexceptionout_of_range405) if the JSON pointer has no parent. ## Complexity diff --git a/docs/mkdocs/docs/api/json_pointer/empty.md b/docs/mkdocs/docs/api/json_pointer/empty.md index 346364ad5..96328bd23 100644 --- a/docs/mkdocs/docs/api/json_pointer/empty.md +++ b/docs/mkdocs/docs/api/json_pointer/empty.md @@ -4,7 +4,7 @@ bool empty() const noexcept; ``` -Return whether pointer points to the root document. +Return whether the pointer points to the root document. ## Return value diff --git a/docs/mkdocs/docs/api/json_pointer/index.md b/docs/mkdocs/docs/api/json_pointer/index.md index 22e246405..8b70e2de7 100644 --- a/docs/mkdocs/docs/api/json_pointer/index.md +++ b/docs/mkdocs/docs/api/json_pointer/index.md @@ -34,10 +34,10 @@ are the base for JSON patches. - [**operator/=**](operator_slasheq.md) - append to the end of the JSON pointer - [**operator/**](operator_slash.md) - create JSON Pointer by appending - [**parent_pointer**](parent_pointer.md) - returns the parent of this JSON pointer -- [**pop_back**](pop_back.md) - remove last reference token +- [**pop_back**](pop_back.md) - remove the last reference token - [**back**](back.md) - return last reference token - [**push_back**](push_back.md) - append an unescaped token at the end of the pointer -- [**empty**](empty.md) - return whether pointer points to the root document +- [**empty**](empty.md) - return whether the pointer points to the root document ## Literals diff --git a/docs/mkdocs/docs/api/json_pointer/pop_back.md b/docs/mkdocs/docs/api/json_pointer/pop_back.md index 3c79f3638..16b1cd4da 100644 --- a/docs/mkdocs/docs/api/json_pointer/pop_back.md +++ b/docs/mkdocs/docs/api/json_pointer/pop_back.md @@ -4,11 +4,11 @@ void pop_back(); ``` -Remove last reference token. +Remove the last reference token. ## Exceptions -Throws [out_of_range.405](../../home/exceptions.md#jsonexceptionout_of_range405) if JSON pointer has no parent. +Throws [out_of_range.405](../../home/exceptions.md#jsonexceptionout_of_range405) if the JSON pointer has no parent. ## Complexity diff --git a/docs/mkdocs/docs/api/json_sax/index.md b/docs/mkdocs/docs/api/json_sax/index.md index f63e85c9a..d66b7a254 100644 --- a/docs/mkdocs/docs/api/json_sax/index.md +++ b/docs/mkdocs/docs/api/json_sax/index.md @@ -17,7 +17,7 @@ processing the input. ## Member types - [**number_integer_t**](../basic_json/number_integer_t.md) - `BasicJsonType`'s type for numbers (integer) -- [**number_unsigned_t**](../basic_json/number_unsigned_t.md) - `BasicJsonType`'s type for numbers (unsigned) +- [**number_unsigned_t**](../basic_json/number_unsigned_t.md) - `BasicJsonType`'s type for numbers (unsigned) - [**number_float_t**](../basic_json/number_float_t.md) - `BasicJsonType`'s type for numbers (floating-point) - [**string_t**](../basic_json/string_t.md) - `BasicJsonType`'s type for strings - [**binary_t**](../basic_json/binary_t.md) - `BasicJsonType`'s type for binary arrays diff --git a/docs/mkdocs/docs/api/macros/json_assert.md b/docs/mkdocs/docs/api/macros/json_assert.md index a35f794ce..2d7b0c78a 100644 --- a/docs/mkdocs/docs/api/macros/json_assert.md +++ b/docs/mkdocs/docs/api/macros/json_assert.md @@ -9,7 +9,7 @@ This macro controls which code is executed for [runtime assertions](../../featur ## Parameters `x` (in) -: expression of scalar type +: expression of a scalar type ## Default definition diff --git a/docs/mkdocs/docs/api/macros/json_diagnostic_positions.md b/docs/mkdocs/docs/api/macros/json_diagnostic_positions.md index 514a9eeb6..f928f227e 100644 --- a/docs/mkdocs/docs/api/macros/json_diagnostic_positions.md +++ b/docs/mkdocs/docs/api/macros/json_diagnostic_positions.md @@ -8,14 +8,14 @@ This macro enables position diagnostics for generated JSON objects. When enabled, two new member functions [`start_pos()`](../basic_json/start_pos.md) and [`end_pos()`](../basic_json/end_pos.md) are added to [`basic_json`](../basic_json/index.md) values. If the value was -created by calling the[`parse`](../basic_json/parse.md) function, then these functions allow to query the byte positions +created by calling the[`parse`](../basic_json/parse.md) function, then these functions allow querying the byte positions of the value in the input it was parsed from. In case the value was constructed by other means, `std::string::npos` is returned. [`start_pos()`](../basic_json/start_pos.md) returns the position of the first character of a given value in the original JSON string, while [`end_pos()`](../basic_json/end_pos.md) returns the position of the character _following_ the last character. For objects and arrays, the first and last characters correspond to the opening or closing braces/brackets, -respectively. For primitive values, the first and last character represent the opening and closing quotes (strings) or +respectively. For primitive values, the first and last character represents the opening and closing quotes (strings) or the first and last character of the field's numerical or predefined value (`true`, `false`, `null`), respectively. | JSON type | return value [`start_pos()`](../basic_json/start_pos.md) | return value [`end_pos()`](../basic_json/end_pos.md) | diff --git a/docs/mkdocs/docs/api/macros/json_diagnostics.md b/docs/mkdocs/docs/api/macros/json_diagnostics.md index 3a553a5a1..91bdc1b39 100644 --- a/docs/mkdocs/docs/api/macros/json_diagnostics.md +++ b/docs/mkdocs/docs/api/macros/json_diagnostics.md @@ -9,7 +9,7 @@ Possible values are `1` to enable or `0` to disable (default). When enabled, exception messages contain a [JSON Pointer](../json_pointer/json_pointer.md) to the JSON value that triggered the exception. Note that enabling this macro increases the size of every JSON value by one pointer and adds -some runtime overhead. +some runtime overhead. ## Default definition @@ -91,4 +91,4 @@ When the macro is not defined, the library will define it to its default value. ## Version history - Added in version 3.10.0. -- As of version 3.11.0 the definition is allowed to vary between translation units. +- As of version 3.11.0, the definition is allowed to vary between translation units. diff --git a/docs/mkdocs/docs/api/macros/json_skip_unsupported_compiler_check.md b/docs/mkdocs/docs/api/macros/json_skip_unsupported_compiler_check.md index 374fa4c27..52cdbd172 100644 --- a/docs/mkdocs/docs/api/macros/json_skip_unsupported_compiler_check.md +++ b/docs/mkdocs/docs/api/macros/json_skip_unsupported_compiler_check.md @@ -4,8 +4,8 @@ #define JSON_SKIP_UNSUPPORTED_COMPILER_CHECK ``` -When defined, the library will not create a compile error when a known unsupported compiler is detected. This allows to -use the library with compilers that do not fully support C++11 and may only work if unsupported features are not used. +When defined, the library will not create a compile error when a known unsupported compiler is detected. This allows +using the library with compilers that do not fully support C++11 and may only work if unsupported features are not used. ## Default definition diff --git a/docs/mkdocs/docs/api/macros/nlohmann_define_derived_type.md b/docs/mkdocs/docs/api/macros/nlohmann_define_derived_type.md index 1b638c99d..d9c9e0422 100644 --- a/docs/mkdocs/docs/api/macros/nlohmann_define_derived_type.md +++ b/docs/mkdocs/docs/api/macros/nlohmann_define_derived_type.md @@ -21,13 +21,13 @@ These macros can be used to simplify the serialization/deserialization of derived types if you want to use a JSON object as serialization and want to use the member variable names as object keys in that object. -- Macros 1, 2 and 3 are to be defined **inside** the class/struct to create code for. +- Macros 1, 2, and 3 are to be defined **inside** the class/struct to create code for. Like [`NLOHMANN_DEFINE_TYPE_INTRUSIVE`](nlohmann_define_type_intrusive.md), they can access private members. -- Macros 4, 5 and 6 are to be defined **outside** the class/struct to create code for, but **inside** its namespace. +- Macros 4, 5, and 6 are to be defined **outside** the class/struct to create code for, but **inside** its namespace. Like [`NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE`](nlohmann_define_type_non_intrusive.md), they **cannot** access private members. -The first parameter is the name of the derived class/struct, +The first parameter is the name of the derived class/struct, the second parameter is the name of the base class/struct and all remaining parameters name the members. The base type **must** be already serializable/deserializable. @@ -57,7 +57,7 @@ Summary: : name of the base type (class, struct) `type` is derived from `member` (in) -: name of the member variable to serialize/deserialize; up to 64 members can be given as comma-separated list +: name of the member variable to serialize/deserialize; up to 64 members can be given as a comma-separated list ## Default definition @@ -79,7 +79,7 @@ template void from_json(const BasicJsonType&, type&); ``` -Macros 3 and 6 add one function to the namespace which take care of the serialization only: +Macros 3 and 6 add one function to the namespace which takes care of the serialization only: ```cpp template @@ -169,9 +169,9 @@ void to_json(BasicJsonType& j, const B& b) { ## Version history -1. Added in version 3.11.x. -2. Added in version 3.11.x. -3. Added in version 3.11.x. -4. Added in version 3.11.x. -5. Added in version 3.11.x. -6. Added in version 3.11.x. +1. Added in version 3.12.0. +2. Added in version 3.12.0. +3. Added in version 3.12.0. +4. Added in version 3.12.0. +5. Added in version 3.12.0. +6. Added in version 3.12.0. diff --git a/docs/mkdocs/docs/api/macros/nlohmann_define_type_intrusive.md b/docs/mkdocs/docs/api/macros/nlohmann_define_type_intrusive.md index 488681ea2..32fb68ee2 100644 --- a/docs/mkdocs/docs/api/macros/nlohmann_define_type_intrusive.md +++ b/docs/mkdocs/docs/api/macros/nlohmann_define_type_intrusive.md @@ -17,7 +17,7 @@ parameter is the name of the class/struct, and all remaining parameters name the 2. Will use [`value`](../basic_json/value.md) during deserialization and fall back to the default value for the respective type of the member variable if a key in the JSON object is missing. The generated `from_json()` function default constructs an object and uses its values as the defaults when calling the `value` function. -3. Only defines the serialization. Useful in cases when the type does not have a default constructor and only serialization in required. +3. Only defines the serialization. Useful in cases when the type does not have a default constructor and only serialization is required. Summary: @@ -33,7 +33,7 @@ Summary: : name of the type (class, struct) to serialize/deserialize `member` (in) -: name of the member variable to serialize/deserialize; up to 64 members can be given as comma-separated list +: name of the member variable to serialize/deserialize; up to 64 members can be given as a comma-separated list ## Default definition diff --git a/docs/mkdocs/docs/api/macros/nlohmann_define_type_non_intrusive.md b/docs/mkdocs/docs/api/macros/nlohmann_define_type_non_intrusive.md index 49c3ac642..2bbf0a690 100644 --- a/docs/mkdocs/docs/api/macros/nlohmann_define_type_non_intrusive.md +++ b/docs/mkdocs/docs/api/macros/nlohmann_define_type_non_intrusive.md @@ -17,7 +17,7 @@ parameter is the name of the class/struct, and all remaining parameters name the 2. Will use [`value`](../basic_json/value.md) during deserialization and fall back to the default value for the respective type of the member variable if a key in the JSON object is missing. The generated `from_json()` function default constructs an object and uses its values as the defaults when calling the `value` function. -3. Only defines the serialization. Useful in cases when the type does not have a default constructor and only serialization in required. +3. Only defines the serialization. Useful in cases when the type does not have a default constructor and only serialization is required. Summary: @@ -33,7 +33,7 @@ Summary: : name of the type (class, struct) to serialize/deserialize `member` (in) -: name of the (public) member variable to serialize/deserialize; up to 64 members can be given as comma-separated list +: name of the (public) member variable to serialize/deserialize; up to 64 members can be given as a comma-separated list ## Default definition diff --git a/docs/mkdocs/docs/api/macros/nlohmann_json_serialize_enum.md b/docs/mkdocs/docs/api/macros/nlohmann_json_serialize_enum.md index e615e65be..c54f9195f 100644 --- a/docs/mkdocs/docs/api/macros/nlohmann_json_serialize_enum.md +++ b/docs/mkdocs/docs/api/macros/nlohmann_json_serialize_enum.md @@ -5,7 +5,7 @@ ``` By default, enum values are serialized to JSON as integers. In some cases this could result in undesired behavior. If an -enum is modified or re-ordered after data has been serialized to JSON, the later de-serialized JSON data may be +enum is modified or re-ordered after data has been serialized to JSON, the later deserialized JSON data may be undefined or a different enum value than was originally intended. The `NLOHMANN_JSON_SERIALIZE_ENUM` allows to define a user-defined serialization for every enumerator. diff --git a/docs/mkdocs/docs/api/operator_gtgt.md b/docs/mkdocs/docs/api/operator_gtgt.md index e76cc0db7..f332a7517 100644 --- a/docs/mkdocs/docs/api/operator_gtgt.md +++ b/docs/mkdocs/docs/api/operator_gtgt.md @@ -21,8 +21,8 @@ the stream `i` ## Exceptions - Throws [`parse_error.101`](../home/exceptions.md#jsonexceptionparse_error101) in case of an unexpected token. -- Throws [`parse_error.102`](../home/exceptions.md#jsonexceptionparse_error102) if to_unicode fails or surrogate error. -- Throws [`parse_error.103`](../home/exceptions.md#jsonexceptionparse_error103) if to_unicode fails. +- Throws [`parse_error.102`](../home/exceptions.md#jsonexceptionparse_error102) if `to_unicode` fails or surrogate error. +- Throws [`parse_error.103`](../home/exceptions.md#jsonexceptionparse_error103) if `to_unicode` fails. ## Complexity diff --git a/docs/mkdocs/docs/api/operator_ltlt.md b/docs/mkdocs/docs/api/operator_ltlt.md index 1718b3c9e..8dedb0509 100644 --- a/docs/mkdocs/docs/api/operator_ltlt.md +++ b/docs/mkdocs/docs/api/operator_ltlt.md @@ -84,4 +84,4 @@ Linear. 1. Added in version 1.0.0. Added support for indentation character and deprecated `#!cpp std::ostream& operator>>(const basic_json& j, std::ostream& o)` in version 3.0.0. -3. Added in version 3.11.0. +2. Added in version 3.11.0. diff --git a/docs/mkdocs/docs/community/index.md b/docs/mkdocs/docs/community/index.md index 15777a383..caef17be3 100644 --- a/docs/mkdocs/docs/community/index.md +++ b/docs/mkdocs/docs/community/index.md @@ -3,5 +3,5 @@ - [Code of Conduct](code_of_conduct.md) - the rules and norms of this project - [Contribution Guidelines](contribution_guidelines.md) - guidelines how to contribute to this project - [Governance](governance.md) - the governance model of this project -- [Quality Assurance](quality_assurance.md) - how quality of this project is assured +- [Quality Assurance](quality_assurance.md) - how the quality of this project is assured - [Security Policy](security_policy.md) - the security policy of the project diff --git a/docs/mkdocs/docs/community/quality_assurance.md b/docs/mkdocs/docs/community/quality_assurance.md index 6f5bae565..134926ca1 100644 --- a/docs/mkdocs/docs/community/quality_assurance.md +++ b/docs/mkdocs/docs/community/quality_assurance.md @@ -10,7 +10,7 @@ violations will result in a failed build. Any compiler with complete C++11 support can compile the library without warnings. -- [x] The library is compiled library with 50+ different C++ compilers with different operating systems and platforms, +- [x] The library is compiled with 50+ different C++ compilers with different operating systems and platforms, including the oldest versions known to compile the library. ??? abstract "Compilers used in continuous integration" @@ -108,7 +108,7 @@ violations will result in a failed build. The library has no prerequisites other than the Standard Template Library (STL). -- [x] The library compiled and tested with both [libc++](https://libcxx.llvm.org) and +- [x] The library is compiled and tested with both [libc++](https://libcxx.llvm.org) and [libstdc++](https://gcc.gnu.org/onlinedocs/libstdc++/) to detect subtle differences or incompatibilities. - [x] The code checked with [Include What You Use (IWYU)](https://include-what-you-use.org) that all required standard headers are included. @@ -123,8 +123,8 @@ violations will result in a failed build. - [x] All public API functions are tested with a variety of arguments. - [x] The library is compiled and tested with different template arguments for number, string, array, and object types. -- [x] All lines of the code base are covered by unit tests. -- [x] Every exception of the library is thrown in the test suite and the error messages and exception ids are checked. +- [x] Unit tests cover all lines of the code base. +- [x] Every exception of the library is thrown in the test suite, and the error messages and exception ids are checked. !!! success "Requirement: Complete documentation" @@ -132,7 +132,7 @@ violations will result in a failed build. - [x] Every public API function has a dedicated page in the [API reference documentation](https://json.nlohmann.me/api/basic_json/) with a self-contained code example. -- [x] All examples in the documentation are tested and changes in their output is treated as an error. +- [x] All examples in the documentation are tested, and changes in their output are treated as an error. ## Robust input processing @@ -200,7 +200,7 @@ violations will result in a failed build. The library can be used by adding a single header to a C++ project. -- [x] An amalgamation script is used to check if the source code is exposed as self-contained single-header file. +- [x] An amalgamation script is used to check if the source code is exposed as a self-contained single-header file. - [x] The test suite is checked against the amalgamated source file as well as the individual source file. !!! success "Requirement: CMake as primary development tool" diff --git a/docs/mkdocs/docs/features/arbitrary_types.md b/docs/mkdocs/docs/features/arbitrary_types.md index 63c4f8ac9..c0fa4515c 100644 --- a/docs/mkdocs/docs/features/arbitrary_types.md +++ b/docs/mkdocs/docs/features/arbitrary_types.md @@ -88,13 +88,13 @@ If you just want to serialize/deserialize some structs, the `to_json`/`from_json There are six macros to make your life easier as long as you (1) want to use a JSON object as serialization and (2) want to use the member variable names as object keys in that object: - [`NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(name, member1, member2, ...)`](../api/macros/nlohmann_define_type_non_intrusive.md) is to be defined inside the namespace of the class/struct to create code for. It will throw an exception in `from_json()` due to a missing value in the JSON object. -- [`NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(name, member1, member2, ...)`](../api/macros/nlohmann_define_type_non_intrusive.md) is to be defined inside the namespace of the class/struct to create code for. It will not throw an exception in `from_json()` due to a missing value in the JSON object, but fills in values from object which is default-constructed by the type. +- [`NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(name, member1, member2, ...)`](../api/macros/nlohmann_define_type_non_intrusive.md) is to be defined inside the namespace of the class/struct to create code for. It will not throw an exception in `from_json()` due to a missing value in the JSON object, but fills in values from an object which is default-constructed by the type. - [`NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE(name, member1, member2, ...)`](../api/macros/nlohmann_define_type_non_intrusive.md) is to be defined inside the namespace of the class/struct to create code for. It does not define a `from_json()` function which is needed in case the type does not have a default constructor. - [`NLOHMANN_DEFINE_TYPE_INTRUSIVE(name, member1, member2, ...)`](../api/macros/nlohmann_define_type_intrusive.md) is to be defined inside the class/struct to create code for. This macro can also access private members. It will throw an exception in `from_json()` due to a missing value in the JSON object. -- [`NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(name, member1, member2, ...)`](../api/macros/nlohmann_define_type_intrusive.md) is to be defined inside the class/struct to create code for. This macro can also access private members. It will not throw an exception in `from_json()` due to a missing value in the JSON object, but fills in values from object which is default-constructed by the type. +- [`NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(name, member1, member2, ...)`](../api/macros/nlohmann_define_type_intrusive.md) is to be defined inside the class/struct to create code for. This macro can also access private members. It will not throw an exception in `from_json()` due to a missing value in the JSON object, but fills in values from an object which is default-constructed by the type. - [`NLOHMANN_DEFINE_TYPE_INTRUSIVE_ONLY_SERIALIZE(name, member1, member2, ...)`](../api/macros/nlohmann_define_type_intrusive.md) is to be defined inside the class/struct to create code for. This macro can also access private members. It does not define a `from_json()` function which is needed in case the type does not have a default constructor. -Furthermore, there exist versions to use in case of derived classes: +Furthermore, there exist versions to use in the case of derived classes: | Need access to private members | Need only de-serialization | Allow missing values when de-serializing | macro | |------------------------------------------------------------------|------------------------------------------------------------------|------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------| @@ -149,9 +149,9 @@ For _derived_ classes and structs, use the following macros ## How do I convert third-party types? -This requires a bit more advanced technique. But first, let's see how this conversion mechanism works: +This requires a bit more advanced technique. But first, let us see how this conversion mechanism works: -The library uses **JSON Serializers** to convert types to json. +The library uses **JSON Serializers** to convert types to JSON. The default serializer for `nlohmann::json` is `nlohmann::adl_serializer` (ADL means [Argument-Dependent Lookup](https://en.cppreference.com/w/cpp/language/adl)). It is implemented like this (simplified): @@ -206,7 +206,7 @@ NLOHMANN_JSON_NAMESPACE_END ## How can I use `get()` for non-default constructible/non-copyable types? -There is a way, if your type is [MoveConstructible](https://en.cppreference.com/w/cpp/named_req/MoveConstructible). You will need to specialize the `adl_serializer` as well, but with a special `from_json` overload: +There is a way if your type is [MoveConstructible](https://en.cppreference.com/w/cpp/named_req/MoveConstructible). You will need to specialize the `adl_serializer` as well, but with a special `from_json` overload: ```cpp struct move_only_type { @@ -241,7 +241,7 @@ namespace nlohmann { Yes. You might want to take a look at [`unit-udt.cpp`](https://github.com/nlohmann/json/blob/develop/tests/src/unit-udt.cpp) in the test suite, to see a few examples. -If you write your own serializer, you'll need to do a few things: +If you write your own serializer, you will need to do a few things: - use a different `basic_json` alias than `nlohmann::json` (the last template parameter of `basic_json` is the `JSONSerializer`) - use your `basic_json` alias (or a template parameter) in all your `to_json`/`from_json` methods diff --git a/docs/mkdocs/docs/features/assertions.md b/docs/mkdocs/docs/features/assertions.md index 9f62249a2..4d75d5a8a 100644 --- a/docs/mkdocs/docs/features/assertions.md +++ b/docs/mkdocs/docs/features/assertions.md @@ -1,7 +1,7 @@ # Runtime Assertions The code contains numerous debug assertions to ensure class invariants are valid or to detect undefined behavior. -Whereas the former class invariants are nothing to be concerned of, the latter checks for undefined behavior are to +Whereas the former class invariants are nothing to be concerned with, the latter checks for undefined behavior are to detect bugs in client code. ## Switch off runtime assertions @@ -19,8 +19,8 @@ before including the `json.hpp` header. ### Unchecked object access to a const value Function [`operator[]`](../api/basic_json/operator%5B%5D.md) implements unchecked access for objects. Whereas a missing -key is added in case of non-const objects, accessing a const object with a missing key is undefined behavior (think of a -dereferenced null pointer) and yields a runtime assertion. +key is added in the case of non-const objects, accessing a const object with a missing key is undefined behavior (think +of a dereferenced null pointer) and yields a runtime assertion. If you are not sure whether an element in an object exists, use checked access with the [`at` function](../api/basic_json/at.md) or call the [`contains` function](../api/basic_json/contains.md) before. @@ -107,9 +107,9 @@ behavior and yields a runtime assertion. ### Reading from a null `FILE` or `char` pointer -Reading from a null `#!cpp FILE` or `#!cpp char` pointer in C++ is undefined behavior. Until version 3.11.4, this +Reading from a null `#!cpp FILE` or `#!cpp char` pointer in C++ is undefined behavior. Until version 3.12.0, this library asserted that the pointer was not `nullptr` using a runtime assertion. If assertions were disabled, this would -result in undefined behavior. Since version 3.11.4, this library checks for `nullptr` and throws a +result in undefined behavior. Since version 3.12.0, this library checks for `nullptr` and throws a [`parse_error.101`](../home/exceptions.md#jsonexceptionparse_error101) to prevent the undefined behavior. ??? example "Example 4: Reading from null pointer" diff --git a/docs/mkdocs/docs/features/binary_formats/bjdata.md b/docs/mkdocs/docs/features/binary_formats/bjdata.md index ae1ef54ec..acfdfb770 100644 --- a/docs/mkdocs/docs/features/binary_formats/bjdata.md +++ b/docs/mkdocs/docs/features/binary_formats/bjdata.md @@ -5,12 +5,12 @@ The [BJData format](https://neurojson.org) was derived from and improved upon array container for efficient storage of N-dimensional packed arrays (**ND-arrays**); it also adds 5 new type markers - `[u] - uint16`, `[m] - uint32`, `[M] - uint64`, `[h] - float16` and `[B] - byte` - to unambiguously map common binary numeric types; furthermore, it uses little-endian (LE) to store all numerics instead of big-endian (BE) as in UBJSON to -avoid unnecessary conversions on commonly available platforms. +avoid unnecessary conversions on commonly available platforms. Compared to other binary JSON-like formats such as MessagePack and CBOR, both BJData and UBJSON demonstrate a rare combination of being both binary and **quasi-human-readable**. This is because all semantic elements in BJData and -UBJSON, including the data-type markers and name/string types are directly human-readable. Data stored in the -BJData/UBJSON format are not only compact in size, fast to read/write, but also can be directly searched or read using +UBJSON, including the data-type markers and name/string types, are directly human-readable. Data stored in the +BJData/UBJSON format is not only compact in size, fast to read/write, but also can be directly searched or read using simple processing. !!! abstract "References" diff --git a/docs/mkdocs/docs/features/binary_formats/index.md b/docs/mkdocs/docs/features/binary_formats/index.md index e74290b09..6714965bd 100644 --- a/docs/mkdocs/docs/features/binary_formats/index.md +++ b/docs/mkdocs/docs/features/binary_formats/index.md @@ -1,6 +1,6 @@ # Binary Formats -Though JSON is a ubiquitous data format, it is not a very compact format suitable for data exchange, for instance over +Though JSON is a ubiquitous data format, it is not a very compact format suitable for data exchange, for instance, over a network. Hence, the library supports - [BJData](bjdata.md) (Binary JData), diff --git a/docs/mkdocs/docs/features/binary_values.md b/docs/mkdocs/docs/features/binary_values.md index 4a15a2ee4..149eaaa5e 100644 --- a/docs/mkdocs/docs/features/binary_values.md +++ b/docs/mkdocs/docs/features/binary_values.md @@ -5,7 +5,7 @@ these formats support binary values; that is, values that have semantics define sequence of bytes to be stored. JSON itself does not have a binary value. As such, binary values are an extension that this library implements to store -values received by a binary format. Binary values are never created by the JSON parser, and are only part of a +values received by a binary format. Binary values are never created by the JSON parser and are only part of a serialized JSON text if they have been created manually or via a binary format. ## API for binary values @@ -130,8 +130,8 @@ is an integer or `null`. ### BJData -[BJData](binary_formats/bjdata.md) neither supports binary values nor subtypes, and proposes to serialize binary values -as array of uint8 values. This translation is implemented by the library. +[BJData](binary_formats/bjdata.md) neither supports binary values nor subtypes and proposes to serialize binary values +as an array of uint8 values. The library implements this translation. ??? example @@ -315,8 +315,8 @@ If no subtype is given, the bin family (bin8, bin16, bin32) is used. ### UBJSON -[UBJSON](binary_formats/ubjson.md) neither supports binary values nor subtypes, and proposes to serialize binary values -as array of uint8 values. This translation is implemented by the library. +[UBJSON](binary_formats/ubjson.md) neither supports binary values nor subtypes and proposes to serialize binary values +as an array of uint8 values. The library implements this translation. ??? example diff --git a/docs/mkdocs/docs/features/comments.md b/docs/mkdocs/docs/features/comments.md index e99cceb49..fca531112 100644 --- a/docs/mkdocs/docs/features/comments.md +++ b/docs/mkdocs/docs/features/comments.md @@ -9,7 +9,7 @@ This library does not support comments *by default*. It does so for three reason > Suppose you are using JSON to keep configuration files, which you would like to annotate. Go ahead and insert all the comments you like. Then pipe it through JSMin before handing it to your JSON parser. -3. It is dangerous for interoperability if some libraries would add comment support while others don't. Please check [The Harmful Consequences of the Robustness Principle](https://tools.ietf.org/html/draft-iab-protocol-maintenance-01) on this. +3. It is dangerous for interoperability if some libraries add comment support while others do not. Please check [The Harmful Consequences of the Robustness Principle](https://tools.ietf.org/html/draft-iab-protocol-maintenance-01) on this. However, you can pass set parameter `ignore_comments` to `#!c true` in the parse function to ignore `//` or `/* */` comments. Comments will then be treated as whitespace. diff --git a/docs/mkdocs/docs/features/element_access/default_value.md b/docs/mkdocs/docs/features/element_access/default_value.md index d169da518..2603a2d18 100644 --- a/docs/mkdocs/docs/features/element_access/default_value.md +++ b/docs/mkdocs/docs/features/element_access/default_value.md @@ -2,7 +2,7 @@ ## Overview -In many situations such as configuration files, missing values are not exceptional, but may be treated as if a default +In many situations, such as configuration files, missing values are not exceptional, but may be treated as if a default value was present. For this case, use [`value(key, default_value)`](../../api/basic_json/value.md) which takes the key you want to access and a default value in case there is no value stored with that key. diff --git a/docs/mkdocs/docs/features/element_access/unchecked_access.md b/docs/mkdocs/docs/features/element_access/unchecked_access.md index 39f06dc9f..f2de067d3 100644 --- a/docs/mkdocs/docs/features/element_access/unchecked_access.md +++ b/docs/mkdocs/docs/features/element_access/unchecked_access.md @@ -29,7 +29,7 @@ similar to a `#!cpp std::map` and a `#!cpp std::vector`, respectively. | `#!cpp j["hobbies"][1]` | `#!json "reading"` | The return value is a reference, so it can modify the original value. In case the passed object key is non-existing, a -`#!json null` value is inserted which can be immediately be overwritten. +`#!json null` value is inserted which can immediately be overwritten. ??? example "Write access" diff --git a/docs/mkdocs/docs/features/enum_conversion.md b/docs/mkdocs/docs/features/enum_conversion.md index 1755bca2a..6bb3edbd3 100644 --- a/docs/mkdocs/docs/features/enum_conversion.md +++ b/docs/mkdocs/docs/features/enum_conversion.md @@ -1,7 +1,7 @@ # Specializing enum conversion By default, enum values are serialized to JSON as integers. In some cases this could result in undesired behavior. If an -enum is modified or re-ordered after data has been serialized to JSON, the later de-serialized JSON data may be +enum is modified or re-ordered after data has been serialized to JSON, the later deserialized JSON data may be undefined or a different enum value than was originally intended. It is possible to more precisely specify how a given enum is mapped to and from JSON as shown below: diff --git a/docs/mkdocs/docs/features/json_pointer.md b/docs/mkdocs/docs/features/json_pointer.md index 4fd58f20e..df66ebffd 100644 --- a/docs/mkdocs/docs/features/json_pointer.md +++ b/docs/mkdocs/docs/features/json_pointer.md @@ -2,8 +2,8 @@ ## Introduction -The library supports **JSON Pointer** ([RFC 6901](https://tools.ietf.org/html/rfc6901)) as alternative means to address -structured values. A JSON Pointer is a string that identifies a specific value within a JSON document. +The library supports **JSON Pointer** ([RFC 6901](https://tools.ietf.org/html/rfc6901)) as an alternative means to +address structured values. A JSON Pointer is a string that identifies a specific value within a JSON document. Consider the following JSON document diff --git a/docs/mkdocs/docs/features/macros.md b/docs/mkdocs/docs/features/macros.md index 211f064b9..a600edbdb 100644 --- a/docs/mkdocs/docs/features/macros.md +++ b/docs/mkdocs/docs/features/macros.md @@ -34,7 +34,7 @@ See [full documentation of `JSON_DIAGNOSTICS`](../api/macros/json_diagnostics.md When enabled, two new member functions [`start_pos()`](../api/basic_json/start_pos.md) and [`end_pos()`](../api/basic_json/end_pos.md) are added to [`basic_json`](../api/basic_json/index.md) values. If the value -was created by calling the[`parse`](../api/basic_json/parse.md) function, then these functions allow to query the byte +was created by calling the[`parse`](../api/basic_json/parse.md) function, then these functions allow querying the byte positions of the value in the input it was parsed from. The byte positions are also used in exceptions to help locate errors. @@ -92,8 +92,8 @@ See [full documentation of `JSON_SKIP_LIBRARY_VERSION_CHECK`](../api/macros/json ## `JSON_SKIP_UNSUPPORTED_COMPILER_CHECK` -When defined, the library will not create a compile error when a known unsupported compiler is detected. This allows to -use the library with compilers that do not fully support C++11 and may only work if unsupported features are not used. +When defined, the library will not create a compile error when a known unsupported compiler is detected. This allows +using the library with compilers that do not fully support C++11 and may only work if unsupported features are not used. See [full documentation of `JSON_SKIP_UNSUPPORTED_COMPILER_CHECK`](../api/macros/json_skip_unsupported_compiler_check.md). diff --git a/docs/mkdocs/docs/features/types/index.md b/docs/mkdocs/docs/features/types/index.md index 1a2a81195..56fb7ebe9 100644 --- a/docs/mkdocs/docs/features/types/index.md +++ b/docs/mkdocs/docs/features/types/index.md @@ -1,6 +1,6 @@ # Types -This page gives an overview how JSON values are stored and how this can be configured. +This page gives an overview of how JSON values are stored and how this can be configured. ## Overview @@ -137,7 +137,7 @@ The choice of `object_t` influences the behavior of the JSON class. With the def ### Key order -The order name/value pairs are added to the object is *not* preserved by the library. Therefore, iterating an object may return name/value pairs in a different order than they were originally stored. In fact, keys will be traversed in alphabetical order as `std::map` with `std::less` is used by default. Please note this behavior conforms to [RFC 8259](https://tools.ietf.org/html/rfc8259), because any order implements the specified "unordered" nature of JSON objects. +The order name/value pairs are added to the object are *not* preserved by the library. Therefore, iterating an object may return name/value pairs in a different order than they were originally stored. In fact, keys will be traversed in alphabetical order as `std::map` with `std::less` is used by default. Please note this behavior conforms to [RFC 8259](https://tools.ietf.org/html/rfc8259), because any order implements the specified "unordered" nature of JSON objects. ### Limits @@ -202,7 +202,7 @@ Strings are stored in UTF-8 encoding. Therefore, functions like `std::string::si [RFC 8259](https://tools.ietf.org/html/rfc8259) states: -> Software implementations are typically required to test names of object members for equality. Implementations that transform the textual representation into sequences of Unicode code units and then perform the comparison numerically, code unit by code unit, are interoperable in the sense that implementations will agree in all cases on equality or inequality of two strings. For example, implementations that compare strings with escaped characters unconverted may incorrectly find that `"a\\b"` and `"a\u005Cb"` are not equal. +> Software implementations are typically required to test names of object members for equality. Implementations that transform the textual representation into sequences of Unicode code units and then perform the comparison numerically, code unit by code unit are interoperable in the sense that implementations will agree in all cases on equality or inequality of two strings. For example, implementations that compare strings with escaped characters unconverted may incorrectly find that `"a\\b"` and `"a\u005Cb"` are not equal. This implementation is interoperable as it does compare strings code unit by code unit. @@ -231,7 +231,7 @@ See the [number handling](number_handling.md) article for a detailed discussion > The representation of numbers is similar to that used in most programming languages. A number is represented in base 10 using decimal digits. It contains an integer component that may be prefixed with an optional minus sign, which may be followed by a fraction part and/or an exponent part. Leading zeros are not allowed. (...) Numeric values that cannot be represented in the grammar below (such as Infinity and NaN) are not permitted. -This description includes both integer and floating-point numbers. However, C++ allows more precise storage if it is known whether the number is a signed integer, an unsigned integer or a floating-point number. Therefore, three different types, `number_integer_t`, `number_unsigned_t`, and `number_float_t` are used. +This description includes both integer and floating-point numbers. However, C++ allows more precise storage if it is known whether the number is a signed integer, an unsigned integer, or a floating-point number. Therefore, three different types, `number_integer_t`, `number_unsigned_t`, and `number_float_t` are used. ### Default types @@ -241,7 +241,7 @@ With the default values for *NumberFloatType* (`#!cpp double`), the default valu ### Default behavior -- The restrictions about leading zeros is not enforced in C++. Instead, leading zeros in integer literals lead to an interpretation as octal number. Internally, the value will be stored as decimal number. For instance, the C++ integer literal `#!c 010` will be serialized to `#!c 8`. During deserialization, leading zeros yield an error. +- The restrictions about leading zeros are not enforced in C++. Instead, leading zeros in integer literals lead to an interpretation as an octal number. Internally, the value will be stored as a decimal number. For instance, the C++ integer literal `#!c 010` will be serialized to `#!c 8`. During deserialization, leading zeros yield an error. - Not-a-number (NaN) values will be serialized to `#!json null`. ### Limits @@ -250,9 +250,9 @@ With the default values for *NumberFloatType* (`#!cpp double`), the default valu > An implementation may set limits on the range and precision of numbers. -When the default type is used, the maximal integer number that can be stored is `#!c 9223372036854775807` (`INT64_MAX`) and the minimal integer number that can be stored is `#!c -9223372036854775808` (`INT64_MIN`). Integer numbers that are out of range will yield over/underflow when used in a constructor. During deserialization, too large or small integer numbers will be automatically be stored as `number_unsigned_t` or `number_float_t`. +When the default type is used, the maximal integer number that can be stored is `#!c 9223372036854775807` (`INT64_MAX`) and the minimal integer number that can be stored is `#!c -9223372036854775808` (`INT64_MIN`). Integer numbers that are out of range will yield over/underflow when used in a constructor. During deserialization, too large or small integer numbers will automatically be stored as `number_unsigned_t` or `number_float_t`. -When the default type is used, the maximal unsigned integer number that can be stored is `#!c 18446744073709551615` (`UINT64_MAX`) and the minimal integer number that can be stored is `#!c 0`. Integer numbers that are out of range will yield over/underflow when used in a constructor. During deserialization, too large or small integer numbers will be automatically be stored as `number_integer_t` or `number_float_t`. +When the default type is used, the maximal unsigned integer number that can be stored is `#!c 18446744073709551615` (`UINT64_MAX`) and the minimal integer number that can be stored is `#!c 0`. Integer numbers that are out of range will yield over/underflow when used in a constructor. During deserialization, too large or small integer numbers will automatically be stored as `number_integer_t` or `number_float_t`. [RFC 8259](https://tools.ietf.org/html/rfc8259) further states: diff --git a/docs/mkdocs/docs/features/types/number_handling.md b/docs/mkdocs/docs/features/types/number_handling.md index 3dcca76a4..87680ba06 100644 --- a/docs/mkdocs/docs/features/types/number_handling.md +++ b/docs/mkdocs/docs/features/types/number_handling.md @@ -54,13 +54,13 @@ On number interoperability, the following remarks are made: ## Library implementation -This section describes how the above number specification is implemented by this library. +This section describes how this library implements the above number specification. ### Number storage In the default [`json`](../../api/json.md) type, numbers are stored as `#!c std::uint64_t`, `#!c std::int64_t`, and -`#!c double`, respectively. Thereby, `#!c std::uint64_t` and `#!c std::int64_t` are used only if they can store the -number without loss of precision. If this is impossible (e.g., if the number is too large), the number is stored as +`#!c double`, respectively. Thereby, `#!c std::uint64_t` and `#!c std::int64_t` are used only if they can store the +number without loss of precision. If this is impossible (e.g., if the number is too large), the number is stored as `#!c double`. !!! info "Notes" @@ -116,7 +116,7 @@ That is, `-0` is stored as a signed integer, but the serialization does not repr - Integer numbers are serialized as is; that is, no scientific notation is used. - Floating-point numbers are serialized as specified by the `#!c %g` printf modifier with [`std::numeric_limits::max_digits10`](https://en.cppreference.com/w/cpp/types/numeric_limits/max_digits10) - significant digits. The rationale is to use the shortest representation while still allow round-tripping. + significant digits. The rationale is to use the shortest representation while still allowing round-tripping. !!! hint "Notes regarding precision of floating-point numbers" @@ -151,7 +151,7 @@ NaN (not-a-number) cannot be expressed with the number syntax described above an Numeric values that cannot be represented in the grammar below (such as Infinity and NaN) are not permitted. -That is, there is no way to *parse* a NaN value. However, NaN values can be stored in a JSON value by assignment. +That is, there is no way to *parse* a NaN value. However, assignments can store NaN values in a JSON value. This library serializes NaN values as `#!js null`. This corresponds to the behavior of JavaScript's [`JSON.stringify`](https://www.w3schools.com/js/js_json_stringify.asp) function. @@ -230,7 +230,7 @@ Floating-point inside JSON values numbers are compared with `#!c json::number_fl ### Number conversion Just like the C++ language itself, the `get` family of functions allows conversions between unsigned and signed -integers, and between integers and floating-point values to integers. This behavior may be surprising. +integers, and between integers and floating-point values to integers. This behavior may be surprising. !!! warning "Unconditional number conversions" @@ -246,7 +246,7 @@ integers, and between integers and floating-point values to integers. This beha The rationale is twofold: 1. JSON does not define a number type or precision (see above). -2. C++ also allows to silently convert between number types. +2. C++ also allows silently converting between number types. !!! success "Conditional number conversion" diff --git a/docs/mkdocs/docs/home/customers.md b/docs/mkdocs/docs/home/customers.md index 6a157bf1a..8e111652a 100644 --- a/docs/mkdocs/docs/home/customers.md +++ b/docs/mkdocs/docs/home/customers.md @@ -7,7 +7,7 @@ the result of an internet search. If you know further customers of the library, ## Space Exploration -- [**Peregrine Lunar Lander Flight 01**](https://en.wikipedia.org/wiki/Peregrine_Mission_One) - The library was utilized for payload management in the **Peregrine Moon Lander**, developed by **Astrobotic Technology** and launched as part of NASA's **Commercial Lunar Payload Services (CLPS)** program. After six days in orbit, the spacecraft was intentionally redirected into Earth's atmosphere, where it burned up over the Pacific Ocean on **January 18, 2024**. +- [**Peregrine Lunar Lander Flight 01**](https://en.wikipedia.org/wiki/Peregrine_Mission_One) - The library was used for payload management in the **Peregrine Moon Lander**, developed by **Astrobotic Technology** and launched as part of NASA's **Commercial Lunar Payload Services (CLPS)** program. After six days in orbit, the spacecraft was intentionally redirected into Earth's atmosphere, where it burned up over the Pacific Ocean on **January 18, 2024**. ## Automotive @@ -84,7 +84,7 @@ the result of an internet search. If you know further customers of the library, - [**Avular Mobile Robotics**](https://www.avular.com/licenses/nlohmann-json-3.9.1.txt): a platform for developing and deploying mobile robotics solutions - [**Google gemma.cpp**](https://github.com/google/gemma.cpp), a lightweight C++ inference engine designed for running AI models from the Gemma family - [**llama.cpp**](https://github.com/ggerganov/llama.cpp), a C++ library designed for efficient inference of large language models (LLMs), enabling streamlined integration into applications -- [**MLX**](https://github.com/ml-explore/mlx), an array framework for machine learning on Apple silicon +- [**MLX**](https://github.com/ml-explore/mlx), an array framework for machine learning on Apple Silicon - [**Mozilla llamafile**](https://github.com/Mozilla-Ocho/llamafile), a tool designed for distributing and executing large language models (LLMs) efficiently using a single file format - [**NVIDIA ACE**](https://docs.nvidia.com/ace/latest/index.html), a suite of real-time AI solutions designed for the development of interactive avatars and digital human applications, enabling scalable and sophisticated user interactions - [**Peer**](https://support.peer.inc/hc/en-us/articles/17261335054235-Licenses): a platform offering personalized AI assistants for interactive learning and creative collaboration @@ -160,4 +160,4 @@ the result of an internet search. If you know further customers of the library, - [**Microsoft Azure IoT SDK**](https://library.e.abb.com/public/2779c5f85f30484192eb3cb3f666a201/IP%20Gateway%20Open%20License%20Declaration_9AKK108467A4095_Rev_C.pdf), a collection of tools and libraries to help developers connect, build, and deploy Internet of Things (IoT) solutions on the Azure cloud platform - [**Microsoft WinGet**](https://github.com/microsoft/winget-cli), a command-line utility included in the Windows Package Manager - [**Pointr**](https://docs-dev.pointr.tech/docs/8.x/Developer%20Portal/Open%20Source%20Licenses/): a platform for indoor positioning and navigation solutions, offering tools and SDKs for developers to create location-based applications -- [**secunet protect4use**](https://www.secunet.com/en/about-us/press/article/elstersecure-bietet-komfortablen-login-ohne-passwort-dank-secunet-protect4use): a secure, passwordless multi-factor authentication solution that transforms smartphones into digital keyrings, ensuring high security for online services and digital identities +- [**secunet protect4use**](https://www.secunet.com/en/about-us/press/article/elstersecure-bietet-komfortablen-login-ohne-passwort-dank-secunet-protect4use): a secure, passwordless multifactor authentication solution that transforms smartphones into digital keyrings, ensuring high security for online services and digital identities diff --git a/docs/mkdocs/docs/home/design_goals.md b/docs/mkdocs/docs/home/design_goals.md index 28e0ce66e..0a0f77029 100644 --- a/docs/mkdocs/docs/home/design_goals.md +++ b/docs/mkdocs/docs/home/design_goals.md @@ -2,7 +2,7 @@ There are myriads of [JSON](https://json.org) libraries out there, and each may even have its reason to exist. Our class had these design goals: -- **Intuitive syntax**. In languages such as Python, JSON feels like a first class data type. We used all the operator magic of modern C++ to achieve the same feeling in your code. +- **Intuitive syntax**. In languages such as Python, JSON feels like a first-class data type. We used all the operator magic of modern C++ to achieve the same feeling in your code. - **Trivial integration**. Our whole code consists of a single header file [`json.hpp`](https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json.hpp). That's it. No library, no subproject, no dependencies, no complex build system. The class is written in vanilla C++11. All in all, everything should require no adjustment of your compiler flags or project settings. diff --git a/docs/mkdocs/docs/home/exceptions.md b/docs/mkdocs/docs/home/exceptions.md index d625deecd..ea43e5975 100644 --- a/docs/mkdocs/docs/home/exceptions.md +++ b/docs/mkdocs/docs/home/exceptions.md @@ -81,7 +81,7 @@ Exceptions in the library are thrown in the local context of the JSON value they This exception can be hard to debug if storing the value `#!c "12"` and accessing it is further apart. -To create better diagnostics messages, each JSON value needs a pointer to its parent value such that a global context (i.e., a path from the root value to the value that lead to the exception) can be created. That global context is provided as [JSON Pointer](../features/json_pointer.md). +To create better diagnostics messages, each JSON value needs a pointer to its parent value such that a global context (i.e., a path from the root value to the value that led to the exception) can be created. That global context is provided as [JSON Pointer](../features/json_pointer.md). As this global context comes at the price of storing one additional pointer per JSON value and runtime overhead to maintain the parent relation, extended diagnostics are disabled by default. They can, however, be enabled by defining the preprocessor symbol [`JSON_DIAGNOSTICS`](../api/macros/json_diagnostics.md) to `1` before including `json.hpp`. @@ -103,7 +103,7 @@ See [documentation of `JSON_DIAGNOSTICS`](../api/macros/json_diagnostics.md) for ## Parse errors -This exception is thrown by the library when a parse error occurs. Parse errors +The library throws this exception when a parse error occurs. Parse errors can occur during the deserialization of JSON text, CBOR, MessagePack, as well as when using JSON Patch. @@ -480,7 +480,7 @@ The offset operators (`+`, `-`, `+=`, `-=`) cannot be used on iterators belongin ### json.exception.invalid_iterator.210 -The iterator range passed to the insert function are not compatible, meaning they do not belong to the same container. Therefore, the range (`first`, `last`) is invalid. +The iterator range passed to the insert function is not compatible, meaning they do not belong to the same container. Therefore, the range (`first`, `last`) is invalid. !!! failure "Example message" @@ -560,7 +560,7 @@ To create an object from an initializer list, the initializer list must consist ### json.exception.type_error.302 -During implicit or explicit value conversion, the JSON type must be compatible to the target type. For instance, a JSON string can only be converted into string types, but not into numbers or boolean types. +During implicit or explicit value conversion, the JSON type must be compatible with the target type. For instance, a JSON string can only be converted into string types, but not into numbers or boolean types. !!! failure "Example messages" @@ -740,7 +740,7 @@ The `dump()` function only works with UTF-8 encoded strings; that is, if you ass ### json.exception.type_error.317 -The dynamic type of the object cannot be represented in the requested serialization format (e.g. a raw `true` or `null` JSON object cannot be serialized to BSON) +The dynamic type of the object cannot be represented in the requested serialization format (e.g., a raw `true` or `null` JSON object cannot be serialized to BSON) !!! failure "Example messages" @@ -759,7 +759,7 @@ The dynamic type of the object cannot be represented in the requested serializat ## Out of range -This exception is thrown in case a library function is called on an input parameter that exceeds the expected range, for instance in case of array indices or nonexisting object keys. +This exception is thrown in case a library function is called on an input parameter that exceeds the expected range, for instance, in the case of array indices or nonexisting object keys. Exceptions have ids 4xx. @@ -819,7 +819,7 @@ A reference token in a JSON Pointer could not be resolved. ### json.exception.out_of_range.405 -The JSON Patch operations 'remove' and 'add' can not be applied to the root element of the JSON value. +The JSON Patch operations 'remove' and 'add' cannot be applied to the root element of the JSON value. !!! failure "Example message" diff --git a/docs/mkdocs/docs/home/faq.md b/docs/mkdocs/docs/home/faq.md index dd426e073..6a5ca3960 100644 --- a/docs/mkdocs/docs/home/faq.md +++ b/docs/mkdocs/docs/home/faq.md @@ -46,7 +46,7 @@ for objects. Can you add an option to ignore trailing commas? -This library does not support any feature which would jeopardize interoperability. +This library does not support any feature that would jeopardize interoperability. ### Parse errors reading non-ASCII characters @@ -59,10 +59,10 @@ This library does not support any feature which would jeopardize interoperabilit The library supports **Unicode input** as follows: -- Only **UTF-8** encoded input is supported which is the default encoding for JSON according to [RFC 8259](https://tools.ietf.org/html/rfc8259.html#section-8.1). +- Only **UTF-8** encoded input is supported, which is the default encoding for JSON, according to [RFC 8259](https://tools.ietf.org/html/rfc8259.html#section-8.1). - `std::u16string` and `std::u32string` can be parsed, assuming UTF-16 and UTF-32 encoding, respectively. These encodings are not supported when reading from files or other input containers. - Other encodings such as Latin-1 or ISO 8859-1 are **not** supported and will yield parse or serialization errors. -- [Unicode noncharacters](http://www.unicode.org/faq/private_use.html#nonchar1) will not be replaced by the library. +- The library will not replace [Unicode noncharacters](http://www.unicode.org/faq/private_use.html#nonchar1). - Invalid surrogates (e.g., incomplete pairs such as `\uDEAD`) will yield parse errors. - The strings stored in the library are UTF-8 encoded. When using the default string type (`std::string`), note that its length/size functions return the number of stored bytes rather than the number of characters or glyphs. - When you store strings with different encodings in the library, calling [`dump()`](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_a50ec80b02d0f3f51130d4abb5d1cfdc5.html#a50ec80b02d0f3f51130d4abb5d1cfdc5) may throw an exception unless `json::error_handler_t::replace` or `json::error_handler_t::ignore` are used as error handlers. @@ -177,4 +177,4 @@ The code compiles successfully with [Android NDK](https://developer.android.com/ - Why do I get a compilation error `'to_string' is not a member of 'std'` (or similarly, for `strtod` or `strtof`)? - Why does the code not compile with MinGW or Android SDK? -This is not an issue with the code, but rather with the compiler itself. On Android, see above to build with a newer environment. For MinGW, please refer to [this site](http://tehsausage.com/mingw-to-string) and [this discussion](https://github.com/nlohmann/json/issues/136) for information on how to fix this bug. For Android NDK using `APP_STL := gnustl_static`, please refer to [this discussion](https://github.com/nlohmann/json/issues/219). +This is not an issue with the code, but rather with the compiler itself. On Android, see above to build with a newer environment. For MinGW, please refer to [this site](http://tehsausage.com/mingw-to-string) and [this discussion](https://github.com/nlohmann/json/issues/136) for information on how to fix this bug. For Android NDK using `APP_STL := gnustl_static`, please refer to [this discussion](https://github.com/nlohmann/json/issues/219). diff --git a/docs/mkdocs/docs/home/releases.md b/docs/mkdocs/docs/home/releases.md index 9b6a41233..af4f3e615 100644 --- a/docs/mkdocs/docs/home/releases.md +++ b/docs/mkdocs/docs/home/releases.md @@ -744,54 +744,54 @@ There are five different exceptions inheriting from [`json::exception`](http://n To support these exception, the `try`/`catch` blocks of your code need to be adjusted: -| new exception | previous exception | -|:--|:--| -| parse_error.101 | invalid_argument | -| parse_error.102 | invalid_argument | -| parse_error.103 | invalid_argument | -| parse_error.104 | invalid_argument | -| parse_error.105 | invalid_argument | -| parse_error.106 | domain_error | -| parse_error.107 | domain_error | -| parse_error.108 | domain_error | -| parse_error.109 | invalid_argument | -| parse_error.110 | out_of_range | -| parse_error.111 | invalid_argument | -| parse_error.112 | invalid_argument | -| invalid_iterator.201 | domain_error | -| invalid_iterator.202 | domain_error | -| invalid_iterator.203 | domain_error | -| invalid_iterator.204 | out_of_range | -| invalid_iterator.205 | out_of_range | -| invalid_iterator.206 | domain_error | -| invalid_iterator.207 | domain_error | -| invalid_iterator.208 | domain_error | -| invalid_iterator.209 | domain_error | -| invalid_iterator.210 | domain_error | -| invalid_iterator.211 | domain_error | -| invalid_iterator.212 | domain_error | -| invalid_iterator.213 | domain_error | -| invalid_iterator.214 | out_of_range | -| type_error.301 | domain_error | -| type_error.302 | domain_error | -| type_error.303 | domain_error | -| type_error.304 | domain_error | -| type_error.305 | domain_error | -| type_error.306 | domain_error | -| type_error.307 | domain_error | -| type_error.308 | domain_error | -| type_error.309 | domain_error | -| type_error.310 | domain_error | -| type_error.311 | domain_error | -| type_error.313 | domain_error | -| type_error.314 | domain_error | -| type_error.315 | domain_error | -| out_of_range.401 | out_of_range | -| out_of_range.402 | out_of_range | -| out_of_range.403 | out_of_range | -| out_of_range.404 | out_of_range | -| out_of_range.405 | domain_error | -| other_error.501 | domain_error | +| new exception | previous exception | +|:---------------------|:-------------------| +| parse_error.101 | invalid_argument | +| parse_error.102 | invalid_argument | +| parse_error.103 | invalid_argument | +| parse_error.104 | invalid_argument | +| parse_error.105 | invalid_argument | +| parse_error.106 | domain_error | +| parse_error.107 | domain_error | +| parse_error.108 | domain_error | +| parse_error.109 | invalid_argument | +| parse_error.110 | out_of_range | +| parse_error.111 | invalid_argument | +| parse_error.112 | invalid_argument | +| invalid_iterator.201 | domain_error | +| invalid_iterator.202 | domain_error | +| invalid_iterator.203 | domain_error | +| invalid_iterator.204 | out_of_range | +| invalid_iterator.205 | out_of_range | +| invalid_iterator.206 | domain_error | +| invalid_iterator.207 | domain_error | +| invalid_iterator.208 | domain_error | +| invalid_iterator.209 | domain_error | +| invalid_iterator.210 | domain_error | +| invalid_iterator.211 | domain_error | +| invalid_iterator.212 | domain_error | +| invalid_iterator.213 | domain_error | +| invalid_iterator.214 | out_of_range | +| type_error.301 | domain_error | +| type_error.302 | domain_error | +| type_error.303 | domain_error | +| type_error.304 | domain_error | +| type_error.305 | domain_error | +| type_error.306 | domain_error | +| type_error.307 | domain_error | +| type_error.308 | domain_error | +| type_error.309 | domain_error | +| type_error.310 | domain_error | +| type_error.311 | domain_error | +| type_error.313 | domain_error | +| type_error.314 | domain_error | +| type_error.315 | domain_error | +| out_of_range.401 | out_of_range | +| out_of_range.402 | out_of_range | +| out_of_range.403 | out_of_range | +| out_of_range.404 | out_of_range | +| out_of_range.405 | domain_error | +| other_error.501 | domain_error | #### Handling of NaN and INF diff --git a/docs/mkdocs/docs/integration/cmake.md b/docs/mkdocs/docs/integration/cmake.md index 5574167ef..fdce8f6d7 100644 --- a/docs/mkdocs/docs/integration/cmake.md +++ b/docs/mkdocs/docs/integration/cmake.md @@ -90,7 +90,7 @@ to the following. ### FetchContent Since CMake v3.11, [FetchContent](https://cmake.org/cmake/help/v3.11/module/FetchContent.html) can be used to -automatically download a release as a dependency at configure type. +automatically download a release as a dependency at configure time. !!! example @@ -167,12 +167,12 @@ Enable the (incorrect) legacy comparison behavior of discarded JSON values by de ### `JSON_MultipleHeaders` -Use non-amalgamated version of the library. This option is `OFF` by default. +Use the non-amalgamated version of the library. This option is `OFF` by default. ### `JSON_SystemInclude` -Treat the library headers like system headers (i.e., adding `SYSTEM` to the [`target_include_directories`](https://cmake.org/cmake/help/latest/command/target_include_directories.html) call) to checks for this library by tools like Clang-Tidy. This option is `OFF` by default. +Treat the library headers like system headers (i.e., adding `SYSTEM` to the [`target_include_directories`](https://cmake.org/cmake/help/latest/command/target_include_directories.html) call) to check for this library by tools like Clang-Tidy. This option is `OFF` by default. ### `JSON_Valgrind` -Execute test suite with [Valgrind](https://valgrind.org). This option is `OFF` by default. Depends on `JSON_BuildTests`. +Execute the test suite with [Valgrind](https://valgrind.org). This option is `OFF` by default. Depends on `JSON_BuildTests`. diff --git a/docs/mkdocs/docs/integration/migration_guide.md b/docs/mkdocs/docs/integration/migration_guide.md index d250f5b20..423b746d2 100644 --- a/docs/mkdocs/docs/integration/migration_guide.md +++ b/docs/mkdocs/docs/integration/migration_guide.md @@ -260,5 +260,5 @@ exact version and configuration is relevant, use macro ## Do not use the `details` namespace -The `details` namespace is not part of the public API of the library and can change in any version without announcement. -Do not rely on any function or type in the `details` namespace. +The `details` namespace is not part of the public API of the library and can change in any version without an +announcement. Do not rely on any function or type in the `details` namespace. diff --git a/docs/mkdocs/docs/integration/package_managers.md b/docs/mkdocs/docs/integration/package_managers.md index bef5e7bc3..9a18396b2 100644 --- a/docs/mkdocs/docs/integration/package_managers.md +++ b/docs/mkdocs/docs/integration/package_managers.md @@ -163,7 +163,7 @@ using the subproject directly. - :octicons-question-24: [Bazel website](https://bazel.build) This repository provides a [Bazel](https://bazel.build/) `MODULE.bazel` and a corresponding `BUILD.bazel` file. Therefore, this -repository can be referenced within a `MODULE.bazel` by rules such as `archive_override`, `git_override`, or `local_path_override`. To use the library you need to depend on the target `@nlohmann_json//:json` (i.e., via `deps` attribute). +repository can be referenced within a `MODULE.bazel` by rules such as `archive_override`, `git_override`, or `local_path_override`. To use the library, you need to depend on the target `@nlohmann_json//:json` (i.e., via `deps` attribute). ??? example @@ -307,7 +307,7 @@ the [nlohmann_json package](https://hunter.readthedocs.io/en/latest/packages/pkg hunter_add_package(nlohmann_json) ``` -Please see the Hunter project for any issues regarding the packaging. +Please see the Hunter project for any issues regarding the packaging. ??? example diff --git a/include/nlohmann/detail/macro_scope.hpp b/include/nlohmann/detail/macro_scope.hpp index b406852a6..e28e2edaf 100644 --- a/include/nlohmann/detail/macro_scope.hpp +++ b/include/nlohmann/detail/macro_scope.hpp @@ -473,7 +473,7 @@ /*! @brief macro @def NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE -@since version 3.11.x +@since version 3.12.0 @sa https://json.nlohmann.me/api/macros/nlohmann_define_derived_type/ */ #define NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE(Type, BaseType, ...) \ @@ -485,7 +485,7 @@ /*! @brief macro @def NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_WITH_DEFAULT -@since version 3.11.x +@since version 3.12.0 @sa https://json.nlohmann.me/api/macros/nlohmann_define_derived_type/ */ #define NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_WITH_DEFAULT(Type, BaseType, ...) \ @@ -497,7 +497,7 @@ /*! @brief macro @def NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_ONLY_SERIALIZE -@since version 3.11.x +@since version 3.12.0 @sa https://json.nlohmann.me/api/macros/nlohmann_define_derived_type/ */ #define NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_ONLY_SERIALIZE(Type, BaseType, ...) \ @@ -507,7 +507,7 @@ /*! @brief macro @def NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE -@since version 3.11.x +@since version 3.12.0 @sa https://json.nlohmann.me/api/macros/nlohmann_define_derived_type/ */ #define NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE(Type, BaseType, ...) \ @@ -519,7 +519,7 @@ /*! @brief macro @def NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_WITH_DEFAULT -@since version 3.11.x +@since version 3.12.0 @sa https://json.nlohmann.me/api/macros/nlohmann_define_derived_type/ */ #define NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Type, BaseType, ...) \ @@ -531,7 +531,7 @@ /*! @brief macro @def NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE -@since version 3.11.x +@since version 3.12.0 @sa https://json.nlohmann.me/api/macros/nlohmann_define_derived_type/ */ #define NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE(Type, BaseType, ...) \ @@ -539,7 +539,7 @@ void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } // inspired from https://stackoverflow.com/a/26745591 -// allows to call any std function as if (e.g. with begin): +// allows calling any std function as if (e.g., with begin): // using std::begin; begin(x); // // it allows using the detected idiom to retrieve the return type diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 3a8061ff6..9433db886 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -2839,7 +2839,7 @@ JSON_HEDLEY_DIAGNOSTIC_POP /*! @brief macro @def NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE -@since version 3.11.x +@since version 3.12.0 @sa https://json.nlohmann.me/api/macros/nlohmann_define_derived_type/ */ #define NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE(Type, BaseType, ...) \ @@ -2851,7 +2851,7 @@ JSON_HEDLEY_DIAGNOSTIC_POP /*! @brief macro @def NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_WITH_DEFAULT -@since version 3.11.x +@since version 3.12.0 @sa https://json.nlohmann.me/api/macros/nlohmann_define_derived_type/ */ #define NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_WITH_DEFAULT(Type, BaseType, ...) \ @@ -2863,7 +2863,7 @@ JSON_HEDLEY_DIAGNOSTIC_POP /*! @brief macro @def NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_ONLY_SERIALIZE -@since version 3.11.x +@since version 3.12.0 @sa https://json.nlohmann.me/api/macros/nlohmann_define_derived_type/ */ #define NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_ONLY_SERIALIZE(Type, BaseType, ...) \ @@ -2873,7 +2873,7 @@ JSON_HEDLEY_DIAGNOSTIC_POP /*! @brief macro @def NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE -@since version 3.11.x +@since version 3.12.0 @sa https://json.nlohmann.me/api/macros/nlohmann_define_derived_type/ */ #define NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE(Type, BaseType, ...) \ @@ -2885,7 +2885,7 @@ JSON_HEDLEY_DIAGNOSTIC_POP /*! @brief macro @def NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_WITH_DEFAULT -@since version 3.11.x +@since version 3.12.0 @sa https://json.nlohmann.me/api/macros/nlohmann_define_derived_type/ */ #define NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Type, BaseType, ...) \ @@ -2897,7 +2897,7 @@ JSON_HEDLEY_DIAGNOSTIC_POP /*! @brief macro @def NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE -@since version 3.11.x +@since version 3.12.0 @sa https://json.nlohmann.me/api/macros/nlohmann_define_derived_type/ */ #define NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE(Type, BaseType, ...) \ @@ -2905,7 +2905,7 @@ JSON_HEDLEY_DIAGNOSTIC_POP void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } // inspired from https://stackoverflow.com/a/26745591 -// allows to call any std function as if (e.g. with begin): +// allows calling any std function as if (e.g., with begin): // using std::begin; begin(x); // // it allows using the detected idiom to retrieve the return type