mirror of
https://github.com/nlohmann/json.git
synced 2026-10-03 21:20:30 +00:00
deploy: 63c10a51fc
This commit is contained in:
File diff suppressed because one or more lines are too long
+7
-7
@@ -3,7 +3,7 @@
|
||||
The library is used in multiple projects, applications, operating systems, etc. The list below is not exhaustive, but
|
||||
the result of an internet search. If you know further customers of the library, [please let me know](mailto:mail@nlohmann.me).
|
||||
|
||||
[](../images/customers.png)
|
||||
[](../images/customers.png)
|
||||
|
||||
## Space Exploration
|
||||
|
||||
@@ -125,7 +125,7 @@ the result of an internet search. If you know further customers of the library,
|
||||
- [**GitHub CodeQL**](https://github.com/github/codeql/blob/main/shared/cpp/Diagnostics.h), a code analysis tool used for identifying security vulnerabilities and bugs in software through semantic queries
|
||||
- [**GoPro ngfx**](https://github.com/gopro/ngfx), a low-level graphics abstraction and profiling framework developed by GoPro
|
||||
- [**gRPC**](https://github.com/grpc/grpc/blob/master/tools/artifact_gen/utils.h), a high-performance universal remote procedure call framework
|
||||
- [**Hex-Rays**](https://docs.hex-rays.com/user-guide/user-interface/licenses), a reverse engineering toolset for analyzing and decompiling binaries, primarily used for security research and vulnerability analysis
|
||||
- [**Hex-Rays**](https://docs.hex-rays.com/core/user-interface/concepts/licenses), a reverse engineering toolset for analyzing and decompiling binaries, primarily used for security research and vulnerability analysis
|
||||
- [**ImHex**](https://github.com/WerWolv/ImHex), a hex editor designed for reverse engineering, providing advanced features for data analysis and manipulation
|
||||
- [**Intel GITS**](https://github.com/intel/gits), a tool for capturing and replaying graphics API calls for debugging and performance analysis
|
||||
- [**Intel GPA Framework**](https://intel.github.io/gpasdk-doc/src/licenses.html), a suite of cross-platform tools for capturing, analyzing, and optimizing graphics applications across different APIs
|
||||
@@ -240,9 +240,9 @@ the result of an internet search. If you know further customers of the library,
|
||||
- [**Manticore Search**](https://github.com/manticoresoftware/manticoresearch/blob/main/src/searchdhttpcompat.cpp), a database for search, offering full-text and vector queries
|
||||
- [**Milvus**](https://github.com/milvus-io/milvus/blob/master/internal/core/src/query/PlanImpl.h), a cloud-native vector database built for embedding similarity search
|
||||
- [**MongoDB**](https://github.com/mongodb/mongo/blob/master/src/mongo/replay/config_handler.cpp), a general-purpose document database
|
||||
- [**MySQL Connector/C++**](https://docs.oracle.com/cd/E17952_01/connector-cpp-9.1-license-com-en/license-opentelemetry-cpp-com.html), a C++ library for connecting and interacting with MySQL databases
|
||||
- [**MySQL NDB Cluster**](https://downloads.mysql.com/docs/licenses/cluster-9.0-com-en.pdf), a distributed database system that provides high availability and scalability for MySQL databases
|
||||
- [**MySQL Shell**](https://downloads.mysql.com/docs/licenses/mysql-shell-8.0-gpl-en.pdf), an advanced client and code editor for interacting with MySQL servers, supporting SQL, Python, and JavaScript
|
||||
- [**MySQL Connector/C++**](https://downloads.mysql.com/docs/licenses/connector-cpp-26.7-com-en.pdf), a C++ library for connecting and interacting with MySQL databases
|
||||
- [**MySQL NDB Cluster**](https://downloads.mysql.com/docs/licenses/cluster-26.7-com-en.pdf), a distributed database system that provides high availability and scalability for MySQL databases
|
||||
- [**MySQL Shell**](https://downloads.mysql.com/docs/licenses/mysql-shell-26.7-gpl-en.pdf), an advanced client and code editor for interacting with MySQL servers, supporting SQL, Python, and JavaScript
|
||||
- [**PrestoDB**](https://github.com/prestodb/presto/blob/master/presto-native-execution/presto_cpp/main/Announcer.cpp), a distributed SQL query engine designed for large-scale data analytics, originally developed by Facebook
|
||||
- [**ROOT Data Analysis Framework**](https://root.cern/doc/v614/classnlohmann_1_1basic__json.html), an open-source data analysis framework widely used in high-energy physics and other fields for data processing and visualization
|
||||
- [**Typesense**](https://github.com/typesense/typesense/blob/v31/include/join.h), an open source typo-tolerant search engine
|
||||
@@ -277,11 +277,11 @@ the result of an internet search. If you know further customers of the library,
|
||||
|
||||
- [**Acronis Cyber Protect Cloud**](https://care.acronis.com/s/article/59533-Third-party-software-used-in-Acronis-Cyber-Protect-Cloud?language=en_US), an all-in-one data protection solution that combines backup, disaster recovery, and cybersecurity to safeguard business data from threats like ransomware
|
||||
- [**Baereos**](https://gitlab.tiger-computing.co.uk/packages/bareos/-/blob/tiger/bullseye/third-party/CLI11/examples/json.cpp), a backup solution that provides data protection and recovery options for various environments, including physical and virtual systems
|
||||
- [**Bitdefender Home Scanner**](https://www.bitdefender.de/site/Main/view/home-scanner-open-source.html), a tool from Bitdefender that scans devices for malware and security threats, providing a safeguard against potential online dangers
|
||||
- [**Bitdefender Home Scanner**](https://www.bitdefender.com/site/Main/view/home-scanner-open-source.html), a tool from Bitdefender that scans devices for malware and security threats, providing a safeguard against potential online dangers
|
||||
- [**Cisco MLS++**](https://github.com/cisco/mlspp), an implementation of the Messaging Layer Security protocol for end-to-end encrypted group messaging
|
||||
- [**Citrix Provisioning**](https://docs.citrix.com/en-us/provisioning/2203-ltsr/downloads/pvs-third-party-notices-2203.pdf), a solution that streamlines the delivery of virtual desktops and applications by allowing administrators to manage and provision resources efficiently across multiple environments
|
||||
- [**Citrix Virtual Apps and Desktops**](https://docs.citrix.com/en-us/citrix-virtual-apps-desktops/2305/downloads/third-party-notices-apps-and-desktops.pdf), a solution from Citrix that delivers virtual apps and desktops
|
||||
- [**Cyberarc**](https://docs.cyberark.com/Downloads/Legal/Privileged%20Session%20Manager%20for%20SSH%20Third-Party%20Notices.pdf), a security solution that specializes in privileged access management, enabling organizations to control and monitor access to critical systems and data, thereby enhancing overall cybersecurity posture
|
||||
- [**CyberArk**](https://docs.cyberark.com/Downloads/Legal/Privileged%20Session%20Manager%20for%20SSH%20Third-Party%20Notices.pdf), a security solution that specializes in privileged access management, enabling organizations to control and monitor access to critical systems and data, thereby enhancing overall cybersecurity posture
|
||||
- [**Deutsche Telekom sysrepo-plugins**](https://github.com/telekom/sysrepo-plugins), a collection of YANG datastore plugins used to manage network devices
|
||||
- [**Egnyte Desktop**](https://helpdesk.egnyte.com/hc/en-us/articles/360007071732-Third-Party-Software-Acknowledgements), a secure cloud storage solution designed for businesses, enabling file sharing, collaboration, and data management across teams while ensuring compliance and data protection
|
||||
- [**Elster**](https://www.secunet.com/en/about-us/press/article/elstersecure-bietet-komfortablen-login-ohne-passwort-dank-secunet-protect4use), a digital platform developed by German tax authorities for secure and efficient electronic tax filing and management using secunet protect4use
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -122,7 +122,7 @@ The library is used in multiple projects, applications, operating systems, etc.
|
||||
- [**GitHub CodeQL**](https://github.com/github/codeql/blob/main/shared/cpp/Diagnostics.h), a code analysis tool used for identifying security vulnerabilities and bugs in software through semantic queries
|
||||
- [**GoPro ngfx**](https://github.com/gopro/ngfx), a low-level graphics abstraction and profiling framework developed by GoPro
|
||||
- [**gRPC**](https://github.com/grpc/grpc/blob/master/tools/artifact_gen/utils.h), a high-performance universal remote procedure call framework
|
||||
- [**Hex-Rays**](https://docs.hex-rays.com/user-guide/user-interface/licenses), a reverse engineering toolset for analyzing and decompiling binaries, primarily used for security research and vulnerability analysis
|
||||
- [**Hex-Rays**](https://docs.hex-rays.com/core/user-interface/concepts/licenses), a reverse engineering toolset for analyzing and decompiling binaries, primarily used for security research and vulnerability analysis
|
||||
- [**ImHex**](https://github.com/WerWolv/ImHex), a hex editor designed for reverse engineering, providing advanced features for data analysis and manipulation
|
||||
- [**Intel GITS**](https://github.com/intel/gits), a tool for capturing and replaying graphics API calls for debugging and performance analysis
|
||||
- [**Intel GPA Framework**](https://intel.github.io/gpasdk-doc/src/licenses.html), a suite of cross-platform tools for capturing, analyzing, and optimizing graphics applications across different APIs
|
||||
@@ -237,9 +237,9 @@ The library is used in multiple projects, applications, operating systems, etc.
|
||||
- [**Manticore Search**](https://github.com/manticoresoftware/manticoresearch/blob/main/src/searchdhttpcompat.cpp), a database for search, offering full-text and vector queries
|
||||
- [**Milvus**](https://github.com/milvus-io/milvus/blob/master/internal/core/src/query/PlanImpl.h), a cloud-native vector database built for embedding similarity search
|
||||
- [**MongoDB**](https://github.com/mongodb/mongo/blob/master/src/mongo/replay/config_handler.cpp), a general-purpose document database
|
||||
- [**MySQL Connector/C++**](https://docs.oracle.com/cd/E17952_01/connector-cpp-9.1-license-com-en/license-opentelemetry-cpp-com.html), a C++ library for connecting and interacting with MySQL databases
|
||||
- [**MySQL NDB Cluster**](https://downloads.mysql.com/docs/licenses/cluster-9.0-com-en.pdf), a distributed database system that provides high availability and scalability for MySQL databases
|
||||
- [**MySQL Shell**](https://downloads.mysql.com/docs/licenses/mysql-shell-8.0-gpl-en.pdf), an advanced client and code editor for interacting with MySQL servers, supporting SQL, Python, and JavaScript
|
||||
- [**MySQL Connector/C++**](https://downloads.mysql.com/docs/licenses/connector-cpp-26.7-com-en.pdf), a C++ library for connecting and interacting with MySQL databases
|
||||
- [**MySQL NDB Cluster**](https://downloads.mysql.com/docs/licenses/cluster-26.7-com-en.pdf), a distributed database system that provides high availability and scalability for MySQL databases
|
||||
- [**MySQL Shell**](https://downloads.mysql.com/docs/licenses/mysql-shell-26.7-gpl-en.pdf), an advanced client and code editor for interacting with MySQL servers, supporting SQL, Python, and JavaScript
|
||||
- [**PrestoDB**](https://github.com/prestodb/presto/blob/master/presto-native-execution/presto_cpp/main/Announcer.cpp), a distributed SQL query engine designed for large-scale data analytics, originally developed by Facebook
|
||||
- [**ROOT Data Analysis Framework**](https://root.cern/doc/v614/classnlohmann_1_1basic__json.html), an open-source data analysis framework widely used in high-energy physics and other fields for data processing and visualization
|
||||
- [**Typesense**](https://github.com/typesense/typesense/blob/v31/include/join.h), an open source typo-tolerant search engine
|
||||
@@ -274,11 +274,11 @@ The library is used in multiple projects, applications, operating systems, etc.
|
||||
|
||||
- [**Acronis Cyber Protect Cloud**](https://care.acronis.com/s/article/59533-Third-party-software-used-in-Acronis-Cyber-Protect-Cloud?language=en_US), an all-in-one data protection solution that combines backup, disaster recovery, and cybersecurity to safeguard business data from threats like ransomware
|
||||
- [**Baereos**](https://gitlab.tiger-computing.co.uk/packages/bareos/-/blob/tiger/bullseye/third-party/CLI11/examples/json.cpp), a backup solution that provides data protection and recovery options for various environments, including physical and virtual systems
|
||||
- [**Bitdefender Home Scanner**](https://www.bitdefender.de/site/Main/view/home-scanner-open-source.html), a tool from Bitdefender that scans devices for malware and security threats, providing a safeguard against potential online dangers
|
||||
- [**Bitdefender Home Scanner**](https://www.bitdefender.com/site/Main/view/home-scanner-open-source.html), a tool from Bitdefender that scans devices for malware and security threats, providing a safeguard against potential online dangers
|
||||
- [**Cisco MLS++**](https://github.com/cisco/mlspp), an implementation of the Messaging Layer Security protocol for end-to-end encrypted group messaging
|
||||
- [**Citrix Provisioning**](https://docs.citrix.com/en-us/provisioning/2203-ltsr/downloads/pvs-third-party-notices-2203.pdf), a solution that streamlines the delivery of virtual desktops and applications by allowing administrators to manage and provision resources efficiently across multiple environments
|
||||
- [**Citrix Virtual Apps and Desktops**](https://docs.citrix.com/en-us/citrix-virtual-apps-desktops/2305/downloads/third-party-notices-apps-and-desktops.pdf), a solution from Citrix that delivers virtual apps and desktops
|
||||
- [**Cyberarc**](https://docs.cyberark.com/Downloads/Legal/Privileged%20Session%20Manager%20for%20SSH%20Third-Party%20Notices.pdf), a security solution that specializes in privileged access management, enabling organizations to control and monitor access to critical systems and data, thereby enhancing overall cybersecurity posture
|
||||
- [**CyberArk**](https://docs.cyberark.com/Downloads/Legal/Privileged%20Session%20Manager%20for%20SSH%20Third-Party%20Notices.pdf), a security solution that specializes in privileged access management, enabling organizations to control and monitor access to critical systems and data, thereby enhancing overall cybersecurity posture
|
||||
- [**Deutsche Telekom sysrepo-plugins**](https://github.com/telekom/sysrepo-plugins), a collection of YANG datastore plugins used to manage network devices
|
||||
- [**Egnyte Desktop**](https://helpdesk.egnyte.com/hc/en-us/articles/360007071732-Third-Party-Software-Acknowledgements), a secure cloud storage solution designed for businesses, enabling file sharing, collaboration, and data management across teams while ensuring compliance and data protection
|
||||
- [**Elster**](https://www.secunet.com/en/about-us/press/article/elstersecure-bietet-komfortablen-login-ohne-passwort-dank-secunet-protect4use), a digital platform developed by German tax authorities for secure and efficient electronic tax filing and management using secunet protect4use
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+23
-23
@@ -41,7 +41,7 @@ Exceptions are used widely within the library. They can, however, be switched of
|
||||
|
||||
Note that [`JSON_THROW_USER`](../api/macros/json_throw_user.md) should leave the current scope (e.g., by throwing or aborting), as continuing after it may yield undefined behavior.
|
||||
|
||||
??? example
|
||||
??? example "Example: switch off exceptions and log errors before aborting"
|
||||
|
||||
The code below switches off exceptions and creates a log entry with a detailed error message in case of errors.
|
||||
|
||||
@@ -67,7 +67,7 @@ See [documentation of `JSON_TRY_USER`, `JSON_CATCH_USER` and `JSON_THROW_USER`](
|
||||
|
||||
Exceptions in the library are thrown in the local context of the JSON value they are detected. This makes detailed diagnostics messages, and hence debugging, difficult.
|
||||
|
||||
??? example
|
||||
??? example "Example: standard diagnostic message"
|
||||
|
||||
```cpp
|
||||
--8<-- "examples/diagnostics_standard.cpp"
|
||||
@@ -85,7 +85,7 @@ To create better diagnostics messages, each JSON value needs a pointer to its pa
|
||||
|
||||
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`.
|
||||
|
||||
??? example
|
||||
??? example "Example: extended diagnostic message with `JSON_DIAGNOSTICS`"
|
||||
|
||||
```cpp
|
||||
--8<-- "examples/diagnostics_extended.cpp"
|
||||
@@ -118,7 +118,7 @@ Exceptions have ids 1xx.
|
||||
is the index of the terminating null byte or the end of file. This also
|
||||
holds true when reading a byte vector (CBOR or MessagePack).
|
||||
|
||||
??? example
|
||||
??? example "Example: catch a `parse_error` exception"
|
||||
|
||||
The following code shows how a `parse_error` exception can be caught.
|
||||
|
||||
@@ -395,7 +395,7 @@ the expected semantics.
|
||||
|
||||
Exceptions have ids 2xx.
|
||||
|
||||
??? example
|
||||
??? example "Example: catch an `invalid_iterator` exception"
|
||||
|
||||
The following code shows how an `invalid_iterator` exception can be caught.
|
||||
|
||||
@@ -421,7 +421,7 @@ The iterators passed to constructor `basic_json(InputIT first, InputIT last)` ar
|
||||
|
||||
### json.exception.invalid_iterator.202
|
||||
|
||||
In the [erase](../api/basic_json/erase.md) or insert function, the passed iterator `pos` does not belong to the JSON value for which the function was called. It hence does not define a valid position for the deletion/insertion.
|
||||
In the [erase](../api/basic_json/erase.md) or [insert](../api/basic_json/insert.md) function, the passed iterator `pos` does not belong to the JSON value for which the function was called. It hence does not define a valid position for the deletion/insertion.
|
||||
|
||||
!!! failure "Example messages"
|
||||
|
||||
@@ -454,7 +454,7 @@ When an iterator range for a primitive type (number, boolean, or string) is pass
|
||||
|
||||
### json.exception.invalid_iterator.205
|
||||
|
||||
When an iterator for a primitive type (number, boolean, or string) is passed to an [erase](../api/basic_json/erase.md) function, the iterator has to be the `begin()` iterator, because it is the only way to address the stored value. All other iterators are invalid.
|
||||
When an iterator for a primitive type (number, boolean, or string) is passed to an [erase](../api/basic_json/erase.md) function, the iterator has to be the [`begin()`](../api/basic_json/begin.md) iterator, because it is the only way to address the stored value. All other iterators are invalid.
|
||||
|
||||
!!! failure "Example message"
|
||||
|
||||
@@ -545,7 +545,7 @@ The order of object iterators cannot be compared, because JSON objects are unord
|
||||
|
||||
### json.exception.invalid_iterator.214
|
||||
|
||||
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()`.
|
||||
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()`](../api/basic_json/begin.md).
|
||||
|
||||
!!! failure "Example message"
|
||||
|
||||
@@ -559,7 +559,7 @@ This exception is thrown in case of a type error; that is, a library function is
|
||||
|
||||
Exceptions have ids 3xx.
|
||||
|
||||
??? example
|
||||
??? example "Example: catch a `type_error` exception"
|
||||
|
||||
The following code shows how a `type_error` exception can be caught.
|
||||
|
||||
@@ -611,7 +611,7 @@ To retrieve a reference to a value stored in a `basic_json` object with `get_ref
|
||||
|
||||
### json.exception.type_error.304
|
||||
|
||||
The `at()` member functions can only be executed for certain JSON types.
|
||||
The [`at()`](../api/basic_json/at.md) member functions can only be executed for certain JSON types.
|
||||
|
||||
!!! failure "Example messages"
|
||||
|
||||
@@ -624,7 +624,7 @@ The `at()` member functions can only be executed for certain JSON types.
|
||||
|
||||
### json.exception.type_error.305
|
||||
|
||||
The `operator[]` member functions can only be executed for certain JSON types.
|
||||
The [`operator[]`](../api/basic_json/operator%5B%5D.md) member functions can only be executed for certain JSON types.
|
||||
|
||||
!!! failure "Example messages"
|
||||
|
||||
@@ -637,7 +637,7 @@ The `operator[]` member functions can only be executed for certain JSON types.
|
||||
|
||||
### json.exception.type_error.306
|
||||
|
||||
The `value()` member functions can only be executed for certain JSON types.
|
||||
The [`value()`](../api/basic_json/value.md) member functions can only be executed for certain JSON types.
|
||||
|
||||
!!! failure "Example message"
|
||||
|
||||
@@ -657,7 +657,7 @@ The [`erase()`](../api/basic_json/erase.md) member functions can only be execute
|
||||
|
||||
### json.exception.type_error.308
|
||||
|
||||
The `push_back()` and `operator+=` member functions can only be executed for certain JSON types.
|
||||
The [`push_back()`](../api/basic_json/push_back.md) and [`operator+=`](../api/basic_json/operator+=.md) member functions can only be executed for certain JSON types.
|
||||
|
||||
!!! failure "Example message"
|
||||
|
||||
@@ -667,7 +667,7 @@ The `push_back()` and `operator+=` member functions can only be executed for cer
|
||||
|
||||
### json.exception.type_error.309
|
||||
|
||||
The `insert()` member functions can only be executed for certain JSON types.
|
||||
The [`insert()`](../api/basic_json/insert.md) member functions can only be executed for certain JSON types.
|
||||
|
||||
!!! failure "Example messages"
|
||||
|
||||
@@ -680,7 +680,7 @@ The `insert()` member functions can only be executed for certain JSON types.
|
||||
|
||||
### json.exception.type_error.310
|
||||
|
||||
The `swap()` member functions can only be executed for certain JSON types.
|
||||
The [`swap()`](../api/basic_json/swap.md) member functions can only be executed for certain JSON types.
|
||||
|
||||
!!! failure "Example message"
|
||||
|
||||
@@ -690,7 +690,7 @@ The `swap()` member functions can only be executed for certain JSON types.
|
||||
|
||||
### json.exception.type_error.311
|
||||
|
||||
The `emplace()` and `emplace_back()` member functions can only be executed for certain JSON types.
|
||||
The [`emplace()`](../api/basic_json/emplace.md) and [`emplace_back()`](../api/basic_json/emplace_back.md) member functions can only be executed for certain JSON types.
|
||||
|
||||
!!! failure "Example messages"
|
||||
|
||||
@@ -703,7 +703,7 @@ The `emplace()` and `emplace_back()` member functions can only be executed for c
|
||||
|
||||
### json.exception.type_error.312
|
||||
|
||||
The `update()` member functions can only be executed for certain JSON types.
|
||||
The [`update()`](../api/basic_json/update.md) member functions can only be executed for certain JSON types.
|
||||
|
||||
!!! failure "Example message"
|
||||
|
||||
@@ -713,7 +713,7 @@ The `update()` member functions can only be executed for certain JSON types.
|
||||
|
||||
### json.exception.type_error.313
|
||||
|
||||
The `unflatten` function converts an object whose keys are JSON Pointers back into an arbitrary nested JSON value. The JSON Pointers must not overlap, because then the resulting value would not be well-defined.
|
||||
The [`unflatten()`](../api/basic_json/unflatten.md) function converts an object whose keys are JSON Pointers back into an arbitrary nested JSON value. The JSON Pointers must not overlap, because then the resulting value would not be well-defined.
|
||||
|
||||
!!! failure "Example message"
|
||||
|
||||
@@ -723,7 +723,7 @@ The `unflatten` function converts an object whose keys are JSON Pointers back in
|
||||
|
||||
### json.exception.type_error.314
|
||||
|
||||
The `unflatten` function only works for an object whose keys are JSON Pointers.
|
||||
The [`unflatten()`](../api/basic_json/unflatten.md) function only works for an object whose keys are JSON Pointers.
|
||||
|
||||
!!! failure "Example message"
|
||||
|
||||
@@ -735,7 +735,7 @@ The `unflatten` function only works for an object whose keys are JSON Pointers.
|
||||
|
||||
### json.exception.type_error.315
|
||||
|
||||
The `unflatten()` function only works for an object whose keys are JSON Pointers and whose values are primitive.
|
||||
The [`unflatten()`](../api/basic_json/unflatten.md) function only works for an object whose keys are JSON Pointers and whose values are primitive.
|
||||
|
||||
!!! failure "Example message"
|
||||
|
||||
@@ -747,7 +747,7 @@ The `unflatten()` function only works for an object whose keys are JSON Pointers
|
||||
|
||||
### json.exception.type_error.316
|
||||
|
||||
The `dump()` function only works with UTF-8 encoded strings; that is, if you assign a `std::string` to a JSON value, make sure it is UTF-8 encoded.
|
||||
The [`dump()`](../api/basic_json/dump.md) function only works with UTF-8 encoded strings; that is, if you assign a `std::string` to a JSON value, make sure it is UTF-8 encoded. See the FAQ entry on [serializing untrusted or invalid UTF-8](faq.md#serializing-untrusted-or-invalid-utf-8) for background and the recommended fix.
|
||||
|
||||
!!! failure "Example message"
|
||||
|
||||
@@ -788,7 +788,7 @@ This exception is thrown in case a library function is called on an input parame
|
||||
|
||||
Exceptions have ids 4xx.
|
||||
|
||||
??? example
|
||||
??? example "Example: catch an `out_of_range` exception"
|
||||
|
||||
The following code shows how an `out_of_range` exception can be caught.
|
||||
|
||||
@@ -1009,7 +1009,7 @@ other exception types.
|
||||
|
||||
Exceptions have ids 5xx.
|
||||
|
||||
??? example
|
||||
??? example "Example: catch an `other_error` exception"
|
||||
|
||||
The following code shows how an `other_error` exception can be caught.
|
||||
|
||||
|
||||
+29
-29
File diff suppressed because one or more lines are too long
+29
-29
@@ -41,7 +41,7 @@ Exceptions are used widely within the library. They can, however, be switched of
|
||||
|
||||
Note that [`JSON_THROW_USER`](https://json.nlohmann.me/api/macros/json_throw_user/index.md) should leave the current scope (e.g., by throwing or aborting), as continuing after it may yield undefined behavior.
|
||||
|
||||
Example
|
||||
Example: switch off exceptions and log errors before aborting
|
||||
|
||||
The code below switches off exceptions and creates a log entry with a detailed error message in case of errors.
|
||||
|
||||
@@ -67,7 +67,7 @@ See [documentation of `JSON_TRY_USER`, `JSON_CATCH_USER` and `JSON_THROW_USER`](
|
||||
|
||||
Exceptions in the library are thrown in the local context of the JSON value they are detected. This makes detailed diagnostics messages, and hence debugging, difficult.
|
||||
|
||||
Example
|
||||
Example: standard diagnostic message
|
||||
|
||||
```
|
||||
#include <iostream>
|
||||
@@ -104,7 +104,7 @@ To create better diagnostics messages, each JSON value needs a pointer to its pa
|
||||
|
||||
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`](https://json.nlohmann.me/api/macros/json_diagnostics/index.md) to `1` before including `json.hpp`.
|
||||
|
||||
Example
|
||||
Example: extended diagnostic message with `JSON_DIAGNOSTICS`
|
||||
|
||||
```
|
||||
#include <iostream>
|
||||
@@ -153,7 +153,7 @@ Member `byte` holds the byte index of the last read character in the input file.
|
||||
|
||||
For an input with n bytes, 1 is the index of the first character and n+1 is the index of the terminating null byte or the end of file. This also holds true when reading a byte vector (CBOR or MessagePack).
|
||||
|
||||
Example
|
||||
Example: catch a `parse_error` exception
|
||||
|
||||
The following code shows how a `parse_error` exception can be caught.
|
||||
|
||||
@@ -461,7 +461,7 @@ This exception is thrown if iterators passed to a library function do not match
|
||||
|
||||
Exceptions have ids 2xx.
|
||||
|
||||
Example
|
||||
Example: catch an `invalid_iterator` exception
|
||||
|
||||
The following code shows how an `invalid_iterator` exception can be caught.
|
||||
|
||||
@@ -508,7 +508,7 @@ Example message
|
||||
|
||||
### json.exception.invalid_iterator.202
|
||||
|
||||
In the [erase](https://json.nlohmann.me/api/basic_json/erase/index.md) or insert function, the passed iterator `pos` does not belong to the JSON value for which the function was called. It hence does not define a valid position for the deletion/insertion.
|
||||
In the [erase](https://json.nlohmann.me/api/basic_json/erase/index.md) or [insert](https://json.nlohmann.me/api/basic_json/insert/index.md) function, the passed iterator `pos` does not belong to the JSON value for which the function was called. It hence does not define a valid position for the deletion/insertion.
|
||||
|
||||
Example messages
|
||||
|
||||
@@ -542,7 +542,7 @@ Example message
|
||||
|
||||
### json.exception.invalid_iterator.205
|
||||
|
||||
When an iterator for a primitive type (number, boolean, or string) is passed to an [erase](https://json.nlohmann.me/api/basic_json/erase/index.md) function, the iterator has to be the `begin()` iterator, because it is the only way to address the stored value. All other iterators are invalid.
|
||||
When an iterator for a primitive type (number, boolean, or string) is passed to an [erase](https://json.nlohmann.me/api/basic_json/erase/index.md) function, the iterator has to be the [`begin()`](https://json.nlohmann.me/api/basic_json/begin/index.md) iterator, because it is the only way to address the stored value. All other iterators are invalid.
|
||||
|
||||
Example message
|
||||
|
||||
@@ -632,7 +632,7 @@ Example message
|
||||
|
||||
### json.exception.invalid_iterator.214
|
||||
|
||||
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()`.
|
||||
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()`](https://json.nlohmann.me/api/basic_json/begin/index.md).
|
||||
|
||||
Example message
|
||||
|
||||
@@ -646,7 +646,7 @@ This exception is thrown in case of a type error; that is, a library function is
|
||||
|
||||
Exceptions have ids 3xx.
|
||||
|
||||
Example
|
||||
Example: catch a `type_error` exception
|
||||
|
||||
The following code shows how a `type_error` exception can be caught.
|
||||
|
||||
@@ -720,7 +720,7 @@ Example messages
|
||||
|
||||
### json.exception.type_error.304
|
||||
|
||||
The `at()` member functions can only be executed for certain JSON types.
|
||||
The [`at()`](https://json.nlohmann.me/api/basic_json/at/index.md) member functions can only be executed for certain JSON types.
|
||||
|
||||
Example messages
|
||||
|
||||
@@ -734,7 +734,7 @@ Example messages
|
||||
|
||||
### json.exception.type_error.305
|
||||
|
||||
The `operator[]` member functions can only be executed for certain JSON types.
|
||||
The [`operator[]`](https://json.nlohmann.me/api/basic_json/operator%5B%5D/index.md) member functions can only be executed for certain JSON types.
|
||||
|
||||
Example messages
|
||||
|
||||
@@ -748,7 +748,7 @@ Example messages
|
||||
|
||||
### json.exception.type_error.306
|
||||
|
||||
The `value()` member functions can only be executed for certain JSON types.
|
||||
The [`value()`](https://json.nlohmann.me/api/basic_json/value/index.md) member functions can only be executed for certain JSON types.
|
||||
|
||||
Example message
|
||||
|
||||
@@ -768,7 +768,7 @@ Example message
|
||||
|
||||
### json.exception.type_error.308
|
||||
|
||||
The `push_back()` and `operator+=` member functions can only be executed for certain JSON types.
|
||||
The [`push_back()`](https://json.nlohmann.me/api/basic_json/push_back/index.md) and [`operator+=`](https://json.nlohmann.me/api/basic_json/operator%2B%3D/index.md) member functions can only be executed for certain JSON types.
|
||||
|
||||
Example message
|
||||
|
||||
@@ -778,7 +778,7 @@ Example message
|
||||
|
||||
### json.exception.type_error.309
|
||||
|
||||
The `insert()` member functions can only be executed for certain JSON types.
|
||||
The [`insert()`](https://json.nlohmann.me/api/basic_json/insert/index.md) member functions can only be executed for certain JSON types.
|
||||
|
||||
Example messages
|
||||
|
||||
@@ -792,7 +792,7 @@ Example messages
|
||||
|
||||
### json.exception.type_error.310
|
||||
|
||||
The `swap()` member functions can only be executed for certain JSON types.
|
||||
The [`swap()`](https://json.nlohmann.me/api/basic_json/swap/index.md) member functions can only be executed for certain JSON types.
|
||||
|
||||
Example message
|
||||
|
||||
@@ -802,7 +802,7 @@ Example message
|
||||
|
||||
### json.exception.type_error.311
|
||||
|
||||
The `emplace()` and `emplace_back()` member functions can only be executed for certain JSON types.
|
||||
The [`emplace()`](https://json.nlohmann.me/api/basic_json/emplace/index.md) and [`emplace_back()`](https://json.nlohmann.me/api/basic_json/emplace_back/index.md) member functions can only be executed for certain JSON types.
|
||||
|
||||
Example messages
|
||||
|
||||
@@ -816,7 +816,7 @@ Example messages
|
||||
|
||||
### json.exception.type_error.312
|
||||
|
||||
The `update()` member functions can only be executed for certain JSON types.
|
||||
The [`update()`](https://json.nlohmann.me/api/basic_json/update/index.md) member functions can only be executed for certain JSON types.
|
||||
|
||||
Example message
|
||||
|
||||
@@ -826,7 +826,7 @@ Example message
|
||||
|
||||
### json.exception.type_error.313
|
||||
|
||||
The `unflatten` function converts an object whose keys are JSON Pointers back into an arbitrary nested JSON value. The JSON Pointers must not overlap, because then the resulting value would not be well-defined.
|
||||
The [`unflatten()`](https://json.nlohmann.me/api/basic_json/unflatten/index.md) function converts an object whose keys are JSON Pointers back into an arbitrary nested JSON value. The JSON Pointers must not overlap, because then the resulting value would not be well-defined.
|
||||
|
||||
Example message
|
||||
|
||||
@@ -836,7 +836,7 @@ Example message
|
||||
|
||||
### json.exception.type_error.314
|
||||
|
||||
The `unflatten` function only works for an object whose keys are JSON Pointers.
|
||||
The [`unflatten()`](https://json.nlohmann.me/api/basic_json/unflatten/index.md) function only works for an object whose keys are JSON Pointers.
|
||||
|
||||
Example message
|
||||
|
||||
@@ -848,7 +848,7 @@ Calling `unflatten()` on an array `[1,2,3]`:
|
||||
|
||||
### json.exception.type_error.315
|
||||
|
||||
The `unflatten()` function only works for an object whose keys are JSON Pointers and whose values are primitive.
|
||||
The [`unflatten()`](https://json.nlohmann.me/api/basic_json/unflatten/index.md) function only works for an object whose keys are JSON Pointers and whose values are primitive.
|
||||
|
||||
Example message
|
||||
|
||||
@@ -860,7 +860,7 @@ Calling `unflatten()` on an object `{"/1", [1,2,3]}`:
|
||||
|
||||
### json.exception.type_error.316
|
||||
|
||||
The `dump()` function only works with UTF-8 encoded strings; that is, if you assign a `std::string` to a JSON value, make sure it is UTF-8 encoded.
|
||||
The [`dump()`](https://json.nlohmann.me/api/basic_json/dump/index.md) function only works with UTF-8 encoded strings; that is, if you assign a `std::string` to a JSON value, make sure it is UTF-8 encoded. See the FAQ entry on [serializing untrusted or invalid UTF-8](https://json.nlohmann.me/home/faq/#serializing-untrusted-or-invalid-utf-8) for background and the recommended fix.
|
||||
|
||||
Example message
|
||||
|
||||
@@ -905,7 +905,7 @@ This exception is thrown in case a library function is called on an input parame
|
||||
|
||||
Exceptions have ids 4xx.
|
||||
|
||||
Example
|
||||
Example: catch an `out_of_range` exception
|
||||
|
||||
The following code shows how an `out_of_range` exception can be caught.
|
||||
|
||||
@@ -1065,7 +1065,7 @@ cannot add value: the JSON Patch 'add' target's parent is of type string, but mu
|
||||
|
||||
Note
|
||||
|
||||
This exception was added in version 3.13.0. Before that, this situation hit an internal assertion (aborting the program in debug builds) or was silently ignored when assertions were disabled.
|
||||
This exception was added in version 3.13.0 unreleased. Before that, this situation hit an internal assertion (aborting the program in debug builds) or was silently ignored when assertions were disabled.
|
||||
|
||||
### json.exception.out_of_range.412
|
||||
|
||||
@@ -1083,7 +1083,7 @@ MessagePack length 4294967296 exceeds maximum of 4294967295
|
||||
|
||||
Note
|
||||
|
||||
This exception was added in version 3.13.0. Before that, the BSON length was silently truncated, and [`to_bson`](https://json.nlohmann.me/api/basic_json/to_bson/index.md) produced documents with negative length prefixes that [`from_bson`](https://json.nlohmann.me/api/basic_json/from_bson/index.md) rejected; [`to_msgpack`](https://json.nlohmann.me/api/basic_json/to_msgpack/index.md) wrote such a value without any length, producing output that could not be read back.
|
||||
This exception was added in version 3.13.0 unreleased. Before that, the BSON length was silently truncated, and [`to_bson`](https://json.nlohmann.me/api/basic_json/to_bson/index.md) produced documents with negative length prefixes that [`from_bson`](https://json.nlohmann.me/api/basic_json/from_bson/index.md) rejected; [`to_msgpack`](https://json.nlohmann.me/api/basic_json/to_msgpack/index.md) wrote such a value without any length, producing output that could not be read back.
|
||||
|
||||
### json.exception.out_of_range.413
|
||||
|
||||
@@ -1097,7 +1097,7 @@ cannot remove value: the JSON Patch 'remove' target's parent is of type number,
|
||||
|
||||
Note
|
||||
|
||||
This exception was added in version 3.13.0. Before that, this situation was silently ignored (the `remove` operation had no effect).
|
||||
This exception was added in version 3.13.0 unreleased. Before that, this situation was silently ignored (the `remove` operation had no effect).
|
||||
|
||||
### json.exception.out_of_range.414
|
||||
|
||||
@@ -1111,7 +1111,7 @@ cannot move value: 'from' path '/0' is a proper prefix of 'path' '/0/0'
|
||||
|
||||
Note
|
||||
|
||||
This exception was added in version 3.13.0. Before that, this situation could succeed with a corrupted result: for an array target, removing the "from" element before the "add" step shifted subsequent indices, so "path" silently re-resolved to a different element than intended.
|
||||
This exception was added in version 3.13.0 unreleased. Before that, this situation could succeed with a corrupted result: for an array target, removing the "from" element before the "add" step shifted subsequent indices, so "path" silently re-resolved to a different element than intended.
|
||||
|
||||
### json.exception.out_of_range.415
|
||||
|
||||
@@ -1125,7 +1125,7 @@ Example message
|
||||
|
||||
Note
|
||||
|
||||
This exception was added in version 3.13.0. Before that, subtypes above 255 were silently truncated modulo 256 instead of raising an error.
|
||||
This exception was added in version 3.13.0 unreleased. Before that, subtypes above 255 were silently truncated modulo 256 instead of raising an error.
|
||||
|
||||
## Further exceptions
|
||||
|
||||
@@ -1133,7 +1133,7 @@ This exception is thrown in case of errors that cannot be classified with the ot
|
||||
|
||||
Exceptions have ids 5xx.
|
||||
|
||||
Example
|
||||
Example: catch an `other_error` exception
|
||||
|
||||
The following code shows how an `other_error` exception can be caught.
|
||||
|
||||
@@ -1201,4 +1201,4 @@ Example message
|
||||
|
||||
Note
|
||||
|
||||
This exception was added in version 3.13.0. Before that, debug builds aborted on an assertion and release builds wrote a `$` marker without `#`, which [`from_ubjson`](https://json.nlohmann.me/api/basic_json/from_ubjson/index.md) then rejected.
|
||||
This exception was added in version 3.13.0 unreleased. Before that, debug builds aborted on an assertion and release builds wrote a `$` marker without `#`, which [`from_ubjson`](https://json.nlohmann.me/api/basic_json/from_ubjson/index.md) then rejected.
|
||||
|
||||
+15
-15
@@ -44,9 +44,9 @@ for objects.
|
||||
json j = json::array({true}); // [true]
|
||||
```
|
||||
|
||||
**Opt-in copy semantics (since version 3.12.0)**
|
||||
**Opt-in copy semantics (since version 3.13.0)**
|
||||
|
||||
If you define `JSON_BRACE_INIT_COPY_SEMANTICS` to `1` before including the library, single-element brace initialization is treated as copy/move instead of creating a single-element array:
|
||||
If you define [`JSON_BRACE_INIT_COPY_SEMANTICS`](../api/macros/json_brace_init_copy_semantics.md) to `1` before including the library, single-element brace initialization is treated as copy/move instead of creating a single-element array:
|
||||
|
||||
```cpp
|
||||
#define JSON_BRACE_INIT_COPY_SEMANTICS 1
|
||||
@@ -85,7 +85,7 @@ The library supports **Unicode input** as follows:
|
||||
- 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.
|
||||
- When you store strings with different encodings in the library, calling [`dump()`](../api/basic_json/dump.md) 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.
|
||||
|
||||
@@ -94,7 +94,7 @@ In most cases, the parser is right to complain, because the input is not UTF-8 e
|
||||
|
||||
!!! question "Questions"
|
||||
|
||||
- Why does `json::parse()` silently ignore part of my input?
|
||||
- Why does [`json::parse()`](../api/basic_json/parse.md) silently ignore part of my input?
|
||||
- Why does a `std::string`/buffer with extra data after the JSON text parse without error, while a similar-looking string with extra text does not?
|
||||
|
||||
A `'\0'` (NUL) byte anywhere in the input is treated the same as the real end of the input, rather than as an ordinary (and, outside of a string, invalid) byte. Everything from that byte onward is silently ignored, without a parse error — including further, otherwise well-formed JSON:
|
||||
@@ -197,8 +197,8 @@ same object -- is a data race and requires external synchronization (e.g., a `st
|
||||
Does this library support JSON Schema validation?
|
||||
|
||||
Not directly, but the companion project [json-schema-validator](https://github.com/pboettch/json-schema-validator)
|
||||
builds JSON Schema (draft 4, 6, 7, and 2019-09) validation on top of this library and is a common recommendation
|
||||
for this use case.
|
||||
builds JSON Schema (draft 7; draft 4 in its older, now-superseded 1.x releases) validation on top of this library
|
||||
and is a common recommendation for this use case.
|
||||
|
||||
## Exceptions
|
||||
|
||||
@@ -296,15 +296,13 @@ If you get ambiguous-overload errors when passing a JSON value to `fmt::format`/
|
||||
|
||||
Why does the code not compile with Android SDK?
|
||||
|
||||
Android defaults to using very old compilers and C++ libraries. To fix this, add the following to your `Application.mk`. This will switch to the LLVM C++ library, the Clang compiler, and enable C++11 and other features disabled by default.
|
||||
Since [NDK r18](https://github.com/android/ndk/wiki/Changelog-r18) (2018), GCC and the `gnustl`/`stlport` C++
|
||||
libraries have been removed from the Android NDK; Clang and `libc++` are now the only compiler and C++ library, and
|
||||
they support C++11 and later out of the box. With a current NDK, no special configuration is needed to use this
|
||||
library.
|
||||
|
||||
```ini
|
||||
APP_STL := c++_shared
|
||||
NDK_TOOLCHAIN_VERSION := clang3.6
|
||||
APP_CPPFLAGS += -frtti -fexceptions
|
||||
```
|
||||
|
||||
The code compiles successfully with [Android NDK](https://developer.android.com/ndk/index.html?hl=ml), Revision 9 - 11 (and possibly later) and [CrystaX's Android NDK](https://www.crystax.net/en/android/ndk) version 10.
|
||||
Only very old NDKs (before r18), which defaulted to GCC and `gnustl`, lacked C++11 library features such as
|
||||
`std::to_string`. If you run into this, update to a current NDK.
|
||||
|
||||
|
||||
### Missing STL function
|
||||
@@ -314,4 +312,6 @@ 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, use a current NDK (see above).
|
||||
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.
|
||||
|
||||
+6
-9
File diff suppressed because one or more lines are too long
+10
-16
@@ -44,9 +44,9 @@ To explicitly create a single-element array, use `json::array({value})`:
|
||||
json j = json::array({true}); // [true]
|
||||
```
|
||||
|
||||
**Opt-in copy semantics (since version 3.12.0)**
|
||||
**Opt-in copy semantics (since version 3.13.0 unreleased)**
|
||||
|
||||
If you define `JSON_BRACE_INIT_COPY_SEMANTICS` to `1` before including the library, single-element brace initialization is treated as copy/move instead of creating a single-element array:
|
||||
If you define [`JSON_BRACE_INIT_COPY_SEMANTICS`](https://json.nlohmann.me/api/macros/json_brace_init_copy_semantics/index.md) to `1` before including the library, single-element brace initialization is treated as copy/move instead of creating a single-element array:
|
||||
|
||||
```
|
||||
#define JSON_BRACE_INIT_COPY_SEMANTICS 1
|
||||
@@ -84,7 +84,7 @@ The library supports **Unicode input** as follows:
|
||||
- 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.
|
||||
- When you store strings with different encodings in the library, calling [`dump()`](https://json.nlohmann.me/api/basic_json/dump/index.md) 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.
|
||||
|
||||
@@ -92,7 +92,7 @@ In most cases, the parser is right to complain, because the input is not UTF-8 e
|
||||
|
||||
Questions
|
||||
|
||||
- Why does `json::parse()` silently ignore part of my input?
|
||||
- Why does [`json::parse()`](https://json.nlohmann.me/api/basic_json/parse/index.md) silently ignore part of my input?
|
||||
- Why does a `std::string`/buffer with extra data after the JSON text parse without error, while a similar-looking string with extra text does not?
|
||||
|
||||
A `'\0'` (NUL) byte anywhere in the input is treated the same as the real end of the input, rather than as an ordinary (and, outside of a string, invalid) byte. Everything from that byte onward is silently ignored, without a parse error — including further, otherwise well-formed JSON:
|
||||
@@ -117,7 +117,7 @@ s.resize(s.find('\0')); // drop everything from the first NUL onward, if any
|
||||
json::parse(s);
|
||||
```
|
||||
|
||||
**Opt-in strict handling (since version 3.13.0)**
|
||||
**Opt-in strict handling (since version 3.13.0 unreleased)**
|
||||
|
||||
Manually trimming every input is easy to forget. If you define [`JSON_STRICT_NUL_HANDLING`](https://json.nlohmann.me/api/macros/json_strict_nul_handling/index.md) to `1` before including the library, a `'\0'` byte is instead rejected like any other unexpected byte and raises `parse_error.101`, instead of being treated as end of input:
|
||||
|
||||
@@ -191,7 +191,7 @@ Question
|
||||
|
||||
Does this library support JSON Schema validation?
|
||||
|
||||
Not directly, but the companion project [json-schema-validator](https://github.com/pboettch/json-schema-validator) builds JSON Schema (draft 4, 6, 7, and 2019-09) validation on top of this library and is a common recommendation for this use case.
|
||||
Not directly, but the companion project [json-schema-validator](https://github.com/pboettch/json-schema-validator) builds JSON Schema (draft 7; draft 4 in its older, now-superseded 1.x releases) validation on top of this library and is a common recommendation for this use case.
|
||||
|
||||
## Exceptions
|
||||
|
||||
@@ -255,7 +255,7 @@ Question
|
||||
- Can I use `std::format("{}", j)` on a JSON value?
|
||||
- Can I use `fmt::format("{}", j)` or `fmt::print("{}", j)` (the [{fmt}](https://github.com/fmtlib/fmt) library) on a JSON value?
|
||||
|
||||
`std::format` works out of the box since version 3.13.0, as long as the standard library provides `<format>` (see [`JSON_HAS_STD_FORMAT`](https://json.nlohmann.me/api/macros/json_has_std_format/index.md)); see [`std::formatter<basic_json>`](https://json.nlohmann.me/api/basic_json/std_formatter/index.md) for details, including the `"{:#}"` pretty-print spec, indent widths (`"{:2}"`), and custom indent characters (`"{:.>#}"`).
|
||||
`std::format` works out of the box since version 3.13.0 unreleased, as long as the standard library provides `<format>` (see [`JSON_HAS_STD_FORMAT`](https://json.nlohmann.me/api/macros/json_has_std_format/index.md)); see [`std::formatter<basic_json>`](https://json.nlohmann.me/api/basic_json/std_formatter/index.md) for details, including the `"{:#}"` pretty-print spec, indent widths (`"{:2}"`), and custom indent characters (`"{:.>#}"`).
|
||||
|
||||
For `fmt`, the library ships [`format_as`](https://json.nlohmann.me/api/basic_json/format_as/index.md), a small customization point `fmt` looks for via argument-dependent lookup. It only has an effect on fmt 10.0.0 through 11.0.2 — from fmt 11.1.0 onwards, `fmt` no longer picks up a `format_as` overload that returns a `std::string`. On such versions (or any version, if you also want the same `"{:#}"`/width/fill-and-align spec support that `std::formatter<basic_json>` has), define your own `fmt::formatter` specialization; see [`format_as`](https://json.nlohmann.me/api/basic_json/format_as/index.md) for a recipe that mirrors it.
|
||||
|
||||
@@ -269,15 +269,9 @@ Question
|
||||
|
||||
Why does the code not compile with Android SDK?
|
||||
|
||||
Android defaults to using very old compilers and C++ libraries. To fix this, add the following to your `Application.mk`. This will switch to the LLVM C++ library, the Clang compiler, and enable C++11 and other features disabled by default.
|
||||
Since [NDK r18](https://github.com/android/ndk/wiki/Changelog-r18) (2018), GCC and the `gnustl`/`stlport` C++ libraries have been removed from the Android NDK; Clang and `libc++` are now the only compiler and C++ library, and they support C++11 and later out of the box. With a current NDK, no special configuration is needed to use this library.
|
||||
|
||||
```
|
||||
APP_STL := c++_shared
|
||||
NDK_TOOLCHAIN_VERSION := clang3.6
|
||||
APP_CPPFLAGS += -frtti -fexceptions
|
||||
```
|
||||
|
||||
The code compiles successfully with [Android NDK](https://developer.android.com/ndk/index.html?hl=ml), Revision 9 - 11 (and possibly later) and [CrystaX's Android NDK](https://www.crystax.net/en/android/ndk) version 10.
|
||||
Only very old NDKs (before r18), which defaulted to GCC and `gnustl`, lacked C++11 library features such as `std::to_string`. If you run into this, update to a current NDK.
|
||||
|
||||
### Missing STL function
|
||||
|
||||
@@ -286,4 +280,4 @@ Questions
|
||||
- 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, use a current NDK (see above). 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.
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
# License
|
||||
|
||||
<img align="right" src="https://149753425.v2.pressablecdn.com/wp-content/uploads/2009/06/OSIApproved_100X125.png">
|
||||
<img align="right" src="https://149753425.v2.pressablecdn.com/wp-content/uploads/2009/06/OSIApproved_100X125.png" alt="OSI approved license">
|
||||
|
||||
The class is licensed under the [MIT License](https://opensource.org/licenses/MIT):
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -4,6 +4,11 @@ This page summarizes the notable changes of every release and links to the relev
|
||||
The **complete release notes** — including all changes, the download files, and their checksums — are
|
||||
published on the [GitHub releases page](https://github.com/nlohmann/json/releases).
|
||||
|
||||
!!! info "Unreleased changes"
|
||||
|
||||
This documentation is built from the `develop` branch and may describe changes that are not part of a release
|
||||
yet. Their version numbers are followed by an <span class="unreleased-version">unreleased</span> badge.
|
||||
|
||||
## v3.12.0 (2025-04-11)
|
||||
|
||||
Fixes bugs found in 3.11.3 and adds several features. All changes are backward-compatible.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -2,6 +2,10 @@
|
||||
|
||||
This page summarizes the notable changes of every release and links to the relevant documentation. The **complete release notes** — including all changes, the download files, and their checksums — are published on the [GitHub releases page](https://github.com/nlohmann/json/releases).
|
||||
|
||||
Unreleased changes
|
||||
|
||||
This documentation is built from the `develop` branch and may describe changes that are not part of a release yet. Their version numbers are followed by an unreleased badge.
|
||||
|
||||
## v3.12.0 (2025-04-11)
|
||||
|
||||
Fixes bugs found in 3.11.3 and adds several features. All changes are backward-compatible.
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ You can sponsor this library at [GitHub Sponsors](https://github.com/sponsors/nl
|
||||
|
||||
## Named Sponsors
|
||||
|
||||
- [Michael Hartmann](https://github.com/reFX-Mike)
|
||||
- Michael Hartmann
|
||||
- [Stefan Hagen](https://github.com/sthagen)
|
||||
- [Steve Sperandeo](https://github.com/homer6)
|
||||
- [Robert Jefe Lindstädt](https://github.com/eljefedelrodeodeljefe)
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -9,7 +9,7 @@ You can sponsor this library at [GitHub Sponsors](https://github.com/sponsors/nl
|
||||
|
||||
## Named Sponsors
|
||||
|
||||
- [Michael Hartmann](https://github.com/reFX-Mike)
|
||||
- Michael Hartmann
|
||||
- [Stefan Hagen](https://github.com/sthagen)
|
||||
- [Steve Sperandeo](https://github.com/homer6)
|
||||
- [Robert Jefe Lindstädt](https://github.com/eljefedelrodeodeljefe)
|
||||
|
||||
Reference in New Issue
Block a user