1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-31 10:24:23 +03:00

Add documentation for comparing json and ordered_json (#3599)

* 📝 add documentation for #3443

* Apply suggestions from code review

Co-authored-by: Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
This commit is contained in:
Niels Lohmann
2022-07-23 20:54:40 +02:00
committed by GitHub
parent e91686cc17
commit 2d48a4d9c5
3 changed files with 51 additions and 0 deletions

View File

@ -99,6 +99,39 @@ Linear.
}
```
!!! note "Comparing different `basic_json` specializations"
Comparing different `basic_json` specializations can have surprising effects. For instance, the result of comparing
the JSON objects
```json
{
"version": 1,
"type": "integer"
}
```
and
```json
{
"type": "integer",
"version": 1
}
```
depends on whether [`nlohmann::json`](../json.md) or [`nlohmann::ordered_json`](../ordered_json.md) is used:
```cpp
--8<-- "examples/operator__equal__specializations.cpp"
```
Output:
```json
--8<-- "examples/operator__equal__specializations.output"
```
## Examples
??? example