* ✏️ fix typos

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* ✏️ address review comments

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* ✏️ address review comments

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

---------

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann
2025-05-04 10:28:24 +02:00
committed by GitHub
parent 0a8b48ac6a
commit 9110918cf8
42 changed files with 329 additions and 325 deletions

View File

@@ -8,7 +8,7 @@ struct adl_serializer;
Serializer that uses ADL ([Argument-Dependent Lookup](https://en.cppreference.com/w/cpp/language/adl)) to choose
`to_json`/`from_json` functions from the types' namespaces.
It is implemented similar to
It is implemented similarly to
```cpp
template<typename ValueType>

View File

@@ -74,7 +74,7 @@ basic_json(basic_json&& other) noexcept;
- **boolean**: `boolean_t` / `bool` can be used.
- **binary**: `binary_t` / `std::vector<uint8_t>` may be used; unfortunately because string literals cannot be
distinguished from binary character arrays by the C++ type system, all types compatible with `const char*` will be
directed to the string constructor instead. This is both for backwards compatibility, and due to the fact that a
directed to the string constructor instead. This is both for backwards compatibility and due to the fact that a
binary type is not a standard JSON type.
See the examples below.

View File

@@ -4,7 +4,7 @@
bool empty() const noexcept;
```
Checks if a JSON value has no elements (i.e. whether its [`size()`](size.md) is `0`).
Checks if a JSON value has no elements (i.e., whether its [`size()`](size.md) is `0`).
## Return value

View File

@@ -29,11 +29,11 @@ void insert(const_iterator first, const_iterator last);
For all cases where an element is added to an **array**, a reallocation can happen, in which case all iterators
(including the [`end()`](end.md) iterator) and all references to the elements are invalidated. Otherwise, only the
[`end()`](end.md) iterator is invalidated. Also, any iterator or reference after the insertion point will point to the
same index which is now a different value.
same index, which is now a different value.
For [`ordered_json`](../ordered_json.md), also adding an element to an **object** can yield a reallocation which again
invalidates all iterators and all references. Also, any iterator or reference after the insertion point will point to
the same index which is now a different value.
the same index, which is now a different value.
## Parameters

View File

@@ -16,7 +16,7 @@ Examples of such functionality might be metadata, additional member functions (e
#### Default type
The default value for `CustomBaseClass` is `void`. In this case an
The default value for `CustomBaseClass` is `void`. In this case, an
[empty base class](https://en.cppreference.com/w/cpp/language/ebo) is used and no additional functionality is injected.
#### Limitations

View File

@@ -79,7 +79,7 @@ template<typename BasicJsonType>
void from_json(const BasicJsonType&, type&);
```
Macros 3 and 6 add one function to the namespace which takes care of the serialization only:
Macros 3 and 6 add one function to the namespace, which takes care of the serialization only:
```cpp
template<typename BasicJsonType>

View File

@@ -46,7 +46,7 @@ template<typename BasicJsonType>
friend void from_json(const BasicJsonType&, type&); // except (3)
```
See examples below for the concrete generated code.
See the examples below for the concrete generated code.
## Notes

View File

@@ -46,7 +46,7 @@ template<typename BasicJsonType>
void from_json(const BasicJsonType&, type&); // except (3)
```
See examples below for the concrete generated code.
See the examples below for the concrete generated code.
## Notes

View File

@@ -4,8 +4,8 @@
#define NLOHMANN_JSON_SERIALIZE_ENUM(type, 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 deserialized JSON data may be
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 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.

View File

@@ -11,7 +11,7 @@ This type preserves the insertion order of object keys.
The type is based on [`ordered_map`](ordered_map.md) which in turn uses a `std::vector` to store object elements.
Therefore, adding object elements can yield a reallocation in which case all iterators (including the
[`end()`](basic_json/end.md) iterator) and all references to the elements are invalidated. Also, any iterator or
reference after the insertion point will point to the same index which is now a different value.
reference after the insertion point will point to the same index, which is now a different value.
## Examples

View File

@@ -1,7 +1,7 @@
# CBOR
The Concise Binary Object Representation (CBOR) is a data format whose design goals include the possibility of extremely
small code size, fairly small message size, and extensibility without the need for version negotiation.
The Concise Binary Object Representation (CBOR) is a data format whose design goals include the possibility of
extremely small code sizes, fairly small message size, and extensibility without the need for version negotiation.
!!! abstract "References"

View File

@@ -1,7 +1,7 @@
# Binary Values
The library implements several [binary formats](binary_formats/index.md) that encode JSON in an efficient way. Most of
these formats support binary values; that is, values that have semantics define outside the library and only define a
these formats support binary values; that is, values that have semantics defined outside the library and only define a
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
@@ -189,7 +189,7 @@ as an array of uint8 values. The library implements this translation.
### BSON
[BSON](binary_formats/bson.md) supports binary values and subtypes. If a subtype is given, it is used and added as
[BSON](binary_formats/bson.md) supports binary values and subtypes. 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.
??? example
@@ -274,7 +274,7 @@ byte array.
[MessagePack](binary_formats/messagepack.md) supports binary values and subtypes. If a subtype is given, the ext family
is used. The library will choose the smallest representation among fixext1, fixext2, fixext4, fixext8, ext8, ext16, and
ext32. The subtype is then added as signed 8-bit integer.
ext32. The subtype is then added as a signed 8-bit integer.
If no subtype is given, the bin family (bin8, bin16, bin32) is used.

View File

@@ -1,8 +1,8 @@
# 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 deserialized JSON data may be
undefined or a different enum value than was originally intended.
By default, enum values are serialized to JSON as integers. In some cases, this could result in undesired behavior. If
the integer values of any enum values are changed after data using those enum values has been serialized to JSON, then
deserializing that JSON would result in a different enum value being restored, or the value not being found at all.
It is possible to more precisely specify how a given enum is mapped to and from JSON as shown below:

View File

@@ -37,7 +37,7 @@ When iterating over objects, values are ordered with respect to the `object_comp
The reason for the order is the lexicographic ordering of the object keys "one", "three", "two".
### Access object key during iteration
### Access object keys during iteration
The JSON iterators have two member functions, `key()` and `value()` to access the object key and stored value, respectively. When calling `key()` on a non-object iterator, an [invalid_iterator.207](../home/exceptions.md#jsonexceptioninvalid_iterator207) exception is thrown.

View File

@@ -64,7 +64,7 @@ configurations to be used in cases where the linker would otherwise output u
To do so, define [`NLOHMANN_JSON_NAMESPACE_NO_VERSION`](../api/macros/nlohmann_json_namespace_no_version.md) to `1`.
This applies to version 3.11.2 and above only, versions 3.11.0 and 3.11.1 can apply the technique described in the next
This applies to version 3.11.2 and above only; versions 3.11.0 and 3.11.1 can apply the technique described in the next
section to emulate the effect of the `NLOHMANN_JSON_NAMESPACE_NO_VERSION` macro.
!!! danger "Use at your own risk"

View File

@@ -520,7 +520,7 @@ The order of object iterators cannot be compared, because JSON objects are unord
### json.exception.invalid_iterator.214
Cannot get value for iterator: Either the iterator belongs to a null value or it is an iterator to a primitive type (number, boolean, or string), but the iterator is different to `begin()`.
Cannot retrieve value from iterator: The iterator either refers to a null value, or it refers to a primitive type (number, boolean, or string), but does not match the iterator returned by `begin()`.
!!! failure "Example message"

View File

@@ -67,7 +67,7 @@ The library supports **Unicode input** as follows:
- 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.
In most cases, the parser is right to complain, because the input is not UTF-8 encoded. This is especially true for Microsoft Windows where Latin-1 or ISO 8859-1 is often the standard encoding.
In most cases, the parser is right to complain, because the input is not UTF-8 encoded. This is especially true for Microsoft Windows, where Latin-1 or ISO 8859-1 is often the standard encoding.
### Wide string handling

View File

@@ -1071,7 +1071,7 @@ This release combines a lot of small fixes and improvements. The release is back
- Improved the performance of the serialization by avoiding the re-creation of a locale object.
- Fixed two MSVC warnings. Compiling the test suite with `/Wall` now only warns about non-inlined functions (C4710) and the deprecation of the constructor from input-stream (C4996).
- Some project internals:
- <img align="right" src="https://bestpractices.coreinfrastructure.org/assets/questions_page_badge-17b338c0e8528d695d8676e23f39f17ca2b89bb88176370803ee69aeebcb5be4.png"> The project has qualified for the [Core Infrastructure Initiative Best Practices Badge](https://bestpractices.coreinfrastructure.org/projects/289). While most requirements where already satisfied, some led to a more explicit documentation of quality-ensuring procedures. For instance, static analysis is now executed with every commit on the build server. Furthermore, the [contribution guidelines document](https://github.com/nlohmann/json/blob/develop/.github/CONTRIBUTING.md) how to communicate security issues privately.
- <img align="right" src="https://bestpractices.coreinfrastructure.org/assets/questions_page_badge-17b338c0e8528d695d8676e23f39f17ca2b89bb88176370803ee69aeebcb5be4.png"> The project has qualified for the [Core Infrastructure Initiative Best Practices Badge](https://bestpractices.coreinfrastructure.org/projects/289). While most requirements where already satisfied, some led to more explicit documentation of quality-ensuring procedures. For instance, static analysis is now executed with every commit on the build server. Furthermore, the [contribution guidelines document](https://github.com/nlohmann/json/blob/develop/.github/CONTRIBUTING.md) how to communicate security issues privately.
- The test suite has been overworked and split into several files to allow for faster compilation and analysis. The execute the test suite, simply execute `make check`.
- The continuous integration with [Travis](https://travis-ci.org/nlohmann/json) was extended with Clang versions 3.6.0 to 3.8.1 and now includes 18 different compiler/OS combinations.
- An 11-day run of [American fuzzy lop](http://lcamtuf.coredump.cx/afl/) checked 962 million inputs on the parser and found no issue.