Changed the example code in the documentation from copy initialization
to direct initialization for `json::json_pointer`.
This prevents compilation errors caused by the constructor being explicit.
Added examples and modified the corresponding documents and unit tests.
Signed-off-by: chirsz-ever <chirsz-ever@outlook.com>
Co-authored-by: Niels Lohmann <niels.lohmann@gmail.com>
Adds pre-multiplication overflow detection to catch cases where dimension
products would exceed size_t max. The previous check only detected when
overflow resulted in exactly 0 or SIZE_MAX, missing other cases.
Retains the original post-multiplication check for backward compatibility.
Adds tests verifying overflow detection with dimensions (2^32+1)×(2^32),
which previously overflowed silently to 2^32.
This prevents custom SAX handlers from receiving incorrect array sizes
that could lead to buffer overflows.
Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
* Specialize char_traits for std::byte to fix from_msgpack (fixes#4756)
Provide a char_traits<std::byte> specialization under __cpp_lib_byte
to allow parsing MessagePack data from containers of std::byte.
Signed-off-by: xuesongtap <tap91624@gmail.com>
Signed-off-by: yexiaochuan <tap91624@gmail.com>
* Fix comments for cstddef include and MessagePack tests
Signed-off-by: xuesongtap <tap91624@gmail.com>
Signed-off-by: yexiaochuan <tap91624@gmail.com>
* Fix include <cstddef> only when __cpp_lib_byte is defined and sufficient
Signed-off-by: yexiaochuan <tap91624@gmail.com>
* Fix clang-tidy warnings in MessagePack std::byte tests
Signed-off-by: yexiaochuan <tap91624@gmail.com>
* Fix handle return value in MessagePack tests
Signed-off-by: yexiaochuan <tap91624@gmail.com>
---------
Signed-off-by: xuesongtap <tap91624@gmail.com>
Signed-off-by: yexiaochuan <tap91624@gmail.com>
* Make std::filesystem::path conversion to/from UTF-8 encoded JSON string explicit.
Signed-off-by: Richard Musil <risa2000x@gmail.com>
* Experimental: Changing C++ standard detection logic to accommodate potential corner cases.
Signed-off-by: Richard Musil <risa2000x@gmail.com>
* Drop C++ standard tests for compilers which do not implement required features.
Signed-off-by: Richard Musil <risa2000x@gmail.com>
* Drop C++ standard tests for MSVC versions which do not implement required features.
Signed-off-by: Richard Musil <risa2000x@gmail.com>
---------
Signed-off-by: Richard Musil <risa2000x@gmail.com>
Co-authored-by: Richard Musil <risa2000x@gmail.com>
* bugfix removeprefix not available in python version < 3.9
there was a problem in my cLion gdb that comes with python version 3.8.
the pretty printer script do not work because the removeprefix function is added in version 3.9.
therefore we need a fix for that.
Signed-off-by: Matthias Popp <mpopp@arri.at>
* fix indentation, use the same indentation size at in class JsonValuePrinter
the indentation size was a mix up, we should use always the same indentation size of 4
Signed-off-by: Matthias Popp <mpopp@arri.at>
* use prefix as variable
easier handling or easier to change
Signed-off-by: Matthias Popp <mpopp@arri.at>
* add variables for easier access
Signed-off-by: Matthias Popp <mpopp@arri.at>
---------
Signed-off-by: Matthias Popp <mpopp@arri.at>
Co-authored-by: Matthias Popp <mpopp@arri.at>
* Support any basic_json type in NLOHMANN_DEFINE_TYPE_* macros
Signed-off-by: kimci86 <kimci86@hotmail.fr>
* Test NLOHMANN_DEFINE_TYPE_* macros also support unordered_json
Signed-off-by: kimci86 <kimci86@hotmail.fr>
* Simplify test about NLOHMANN_DEFINE_TYPE_ with many arguments
Signed-off-by: kimci86 <kimci86@hotmail.fr>
* Remove extra scope in macros tests
Signed-off-by: kimci86 <kimci86@hotmail.fr>
* Remove unused test class in macros tests
Signed-off-by: kimci86 <kimci86@hotmail.fr>
* Update documentation about NLOHMANN_DEFINE_TYPE_* macros
Signed-off-by: kimci86 <kimci86@hotmail.fr>
* Fix NLOHMANN_JSON_SERIALIZE_ENUM documentation
Signed-off-by: kimci86 <kimci86@hotmail.fr>
* Mark some variables const in macros tests, fixes clang-tidy
Signed-off-by: kimci86 <kimci86@hotmail.fr>
* Workaround clang 3.5 issue with const object initialization
Signed-off-by: kimci86 <kimci86@hotmail.fr>
* Update highlighted lines in NLOHMANN_DEFINE_TYPE_* macros examples
Signed-off-by: kimci86 <kimci86@hotmail.fr>
* Fix swapped macros in documentation
Signed-off-by: kimci86 <kimci86@hotmail.fr>
* Remove extra backslashes at the end of macros
Signed-off-by: kimci86 <kimci86@hotmail.fr>
* Require basic_json type in NLOHMANN_DEFINE_TYPE_* generated functions
Signed-off-by: kimci86 <kimci86@hotmail.fr>
* Fix typos in macros documentation
Signed-off-by: kimci86 <kimci86@hotmail.fr>
---------
Signed-off-by: kimci86 <kimci86@hotmail.fr>
* Support BSON uint64 de/serialization
Signed-off-by: Michael Valladolid <mikevalladolid@gmail.com>
* Treat 0x11 as uint64 and not timestamp specific
Signed-off-by: Michael Valladolid <mikevalladolid@gmail.com>
---------
Signed-off-by: Michael Valladolid <mikevalladolid@gmail.com>
* Add nav items for serialize macros
Signed-off-by: Nikhil <nikhilreddydev@gmail.com>
* match order of non-intrusive macros to intrusive macros
Signed-off-by: Nikhil <nikhilreddydev@gmail.com>
* Add missing macros and link for more info
Signed-off-by: Nikhil <nikhilreddydev@gmail.com>
* Add @brief macro tags
Signed-off-by: Nikhil <nikhilreddydev@gmail.com>
* make amalgamate
Signed-off-by: Nikhil <nikhilreddydev@gmail.com>
* Add since version tags
Signed-off-by: Nikhil <nikhilreddydev@gmail.com>
* Revert "Add missing macros and link for more info"
This reverts commit 4c9b3ae9bf7a25c81dc1c6217a72a30a39086979.
Signed-off-by: Nikhil <nikhilreddydev@gmail.com>
---------
Signed-off-by: Nikhil <nikhilreddydev@gmail.com>
* change NLOHMANN_JSON_FROM_WITH_DEFAULT to let NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT work with an empty JSON instance
* fix ci_static_analysis_clang (ci_clang_tidy)
* change NLOHMANN_JSON_FROM_WITH_DEFAULT to let NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT work with an empty JSON instance
* Add implementation to retrieve start and end positions of json during parse
* Add more unit tests and add start/stop parsing for arrays
* Add raw value for all types
* Add more tests and fix compiler warning
* Amalgamate
* Fix CLang GCC warnings
* Fix error in build
* Style using astyle 3.1
* Fix whitespace changes
* revert
* more whitespace reverts
* Address PR comments
* Fix failing issues
* More whitespace reverts
* Address remaining PR comments
* Address comments
* Switch to using custom base class instead of default basic_json
* Adding a basic using for a json using the new base class. Also address PR comments and fix CI failures
* Address decltype comments
* Diagnostic positions macro (#4)
Co-authored-by: Sush Shringarputale <sushring@linux.microsoft.com>
* Fix missed include deletion
* Add docs and address other PR comments (#5)
* Add docs and address other PR comments
---------
Co-authored-by: Sush Shringarputale <sushring@linux.microsoft.com>
* Address new PR comments and fix CI tests for documentation
* Update documentation based on feedback (#6)
---------
Co-authored-by: Sush Shringarputale <sushring@linux.microsoft.com>
* Address std::size_t and other comments
* Fix new CI issues
* Fix lcov
* Improve lcov case with update to handle_diagnostic_positions call for discarded values
* Fix indentation of LCOV_EXCL_STOP comments
* fix amalgamation astyle issue
---------
Co-authored-by: Sush Shringarputale <sushring@linux.microsoft.com>
* 🔧 add more GCC warning flags
* 👷 use GCC image for GCC test
* 👷 use GCC image for GCC test
* 👷 use GCC image for GCC test
* 👷 use GCC image for GCC test
* 👷 use GCC image for GCC test
* 👷 use GCC image for GCC test
* 👷 use GCC image for GCC test
* 👷 use GCC image for GCC test
* 🔧 adjust flags
* 👷 adjust jobs
* 👷 adjust jobs
* multibyte binary reader
* wide_string_input_adapter fallback to get_character
Update input_adapters.hpp
* Update json.hpp
* Add from msgpack test
* Test for broken msgpack with stream, address some warnings
* Reading binary number from wchar as an error, address warnings
* Not casting float to int, it violates strict aliasing rule
* CMake: configure pkg-config with @only
And use @ replacement instead of {}, since ${} is significant in
pkg-config's format
* CMake: use conventional prefix and incluedir variables in pkg-config
This is more standard, and has some advantages when cross compiling.
This also means that the pkg-config files generated by Meson and CMake
now match.
* fix: integer parsed as float when EINTR set in errno
* chore: make amalgamate
* chore: make pretty
---------
Co-authored-by: Stuart Gorman <Stuart.Gorman@kallipr.com>
* Possible fix for #4485
Throw's an exception when i is nullptr,
also added a testcase for this scenario though most likely in the wrong test file.cpp
* quick cleanup
* Fix compile issues
* moved tests around, changed exceptions, removed a possibly unneeded include
* add back include <memory> for testing something
* Ninja doesn't like not having a \n, at end of file, adding it back
* update input_adapter file to deal with empty/null file ptr.
* ran make pretty
* added test for inputadapter
* ran make amalgamate
* Update tests/src/unit-deserialization.cpp
Co-authored-by: Niels Lohmann <niels.lohmann@gmail.com>
* Update tests/src/unit-deserialization.cpp
Co-authored-by: Niels Lohmann <niels.lohmann@gmail.com>
* Update input adapters.hpp with new includes
* fix unabigious use of _, (there was a double declare)
* did the amalagamate
* rm duplicate includes
* make amalgamate again
* reorder
* amalgamate
* moved it above
* amalgamate
---------
Co-authored-by: Jordan <jordan-hoang@users.noreply.github.com>
Co-authored-by: Niels Lohmann <niels.lohmann@gmail.com>
* 🚧 conversions for std::optional
* 🏁 fix <optional> inclusion
* 💚 overwork tests
* Use JSON_HAS_CPP_17 only after it has been defined
* ✅ update tests
* 🏁 include right <optional> header
* ♻️ do not include experimental headers
* Add missing #endif after rebase
* Fix failing test
* Only define conversion to std::optional when JSON_USE_IMPLICIT_CONVERSION is disabled.
* missing endif
* Remove Wfloat-equal suppress
* amalgamate
* Move include of optional out of macro_scope; probably does not make sense to be there
* Make clang-tidy happy
* Suppress lint instead of changing to 'contains'
---------
Co-authored-by: Niels Lohmann <mail@nlohmann.me>
Co-authored-by: Markus Palonen <markus.palonen@gmail.com>
* Update natvis Jinja template to reflect the current structure of basic_json.
In 5a1a57510a the underlying structure of
basic_json was altered to move m_type and m_value under an m_data field.
This updates the nativ template to be consistent with this change.
* Generate nlohmann_json.natvis for 3.11.3 and latest basic_json structure.
* Enhance the UDT unit test to expose the issue
Add a new enum type with uint64_t as the underlying type.
Use it in the overall UDT. Not strictly needed, but it helps exercise its expected usage.
Create an object of this enum type with a large value (negative if cast to int64_t).
Perform several checks on this object as converted to `json`, which fail without the fix.
* Fix the issue in the relevant `to_json` overload.
Select the correct json type depending on the signedness of the enum's underlying type.
This fixes the new checks in the unit test.
* Add the fix to the single_include
I ran `make pretty` but that modified 20 files, performing a significant amount of indentation changes, none of them related to my change.
I ran `make amalgamate`, but that did nothing. Apparently, the make rule won't run if the single_include files have already been updated by `make pretty`.
I forced `make amalgamate` to do the work by touching the file with the fix.
I then decided to keep just the minimal needed change: the addition of the fix to the single_include file.
I just am not conversant enough in Linux to know whether I installed astyle correctly (had to clone the source from a beta branch and build, in order to get support for `--squeeze-lines`).
* Resolve CI errors and use qualified `std::uint64_t`
The fix was relying on implicit conversions in the non-taken branch.
- Ordinarily (work on a C++20 codebase) I would have used `if constexpr` here, sidestepping the issue, but that's not available on C++11 so I didn't bother.
- So instead of an `if` statement, I used a compile-time constant to select the correct overload.
- This is arguably better in this case, anyway.
I was using function-style casts for typed constants, which I consider superior for constants, but the CI checks disagree, so changed all to `static_cast`.
- For some reason, the CI checks didn't point at all of them, so I hope I caught them all myself.
Built with clang14 and all unit tests pass.
---------
Co-authored-by: Juan Carlos Arevalo Baeza (JCAB) <jcab@ntdev.microsoft.com>
Starting with CMake 3.27, deprecation warnings are issued
when asking for policy settings for CMake 3.4 or earlier.
The cmake_minimum_required() command accepts a version
range, which allows NEW policy settings up to the upper end
of that range to be used, but without raising the minimum
CMake version above the bottom of that range. This means
NEW policy settings will be used where available, without
requiring them. This change updates the project's
cmake_minimum_required() calls to use a version range to
extend the upper policy version to 3.14 where it wasn't already
at that version or higher. This prevents the deprecation warning
from CMake 3.27, and gives breathing space before a future
CMake release will start issuing similar deprecation warnings
again.
* Reimplement value() access functions
* Merges the 'const char *' with the 'ValueType &&' overloads.
* Fixes ambiguities when default value is 0.
* Fixes 'no matching function' error when specifying ValueType template
parameter.
* Fixes incorrect template parameter order in previous overloads.
* Add additional value() tests
* Make JSON_MultipleHeaders visible to unit tests
Define the macro JSON_TEST_USING_MULTIPLE_HEADERS to 0/1 depending on
JSON_MultipleHeaders.
* Add type_traits unit test
* Update documentation
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
Examples of behavior that contributes to a positive environment for our
community include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community
Examples of unacceptable behavior by participants include:
Examples of unacceptable behavior include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
## Enforcement Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at mail@nlohmann.me. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[mail@nlohmann.me](mailto:mail@nlohmann.me).
All complaints will be reviewed and investigated promptly and fairly.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series of
actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within the
community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
Thank you for your interest in contributing to this project! What began as an exercise to explore the exciting features
of C++11 has evolved into a [widely used](https://json.nlohmann.me/home/customers/) JSON library. I truly appreciate all
the contributions from the community, whether it's proposing features, identifying bugs, or fixing mistakes! To ensure
that our collaboration is efficient and effective, please follow these guidelines.
This project started as a little excuse to exercise some of the cool new C++11 features. Over time, people actually started to use the JSON library (yey!) and started to help improve it by proposing features, finding bugs, or even fixing my mistakes. I am really [thankful](https://github.com/nlohmann/json/blob/master/README.md#thanks) for this and try to keep track of all the helpers.
Feel free to discuss or suggest improvements to this document
[by submitting a pull request](https://github.com/nlohmann/json/edit/develop/.github/CONTRIBUTING.md).
To make it as easy as possible for you to contribute and for me to keep an overview, here are a few guidelines which should help us avoid all kinds of unnecessary work or disappointment. And of course, this document is subject to discussion, so please [create an issue](https://github.com/nlohmann/json/issues/new/choose) or a pull request if you find a way to improve it!
## Ways to Contribute
## Private reports
There are multiple ways to contribute.
Usually, all issues are tracked publicly on [GitHub](https://github.com/nlohmann/json/issues). If you want to make a private report (e.g., for a vulnerability or to attach an example that is not meant to be published), please send an email to <mail@nlohmann.me>.
### Reporting an issue
## Prerequisites
Please [create an issue](https://github.com/nlohmann/json/issues/new/choose), assuming one does not already exist, and describe your concern. Note you need a [GitHub account](https://github.com/signup/free) for this.
## Describe your issue
Please [create an issue](https://github.com/nlohmann/json/issues/new/choose), assuming one does not already exist, and
describe your concern. Note you need a [GitHub account](https://github.com/signup/free) for this.
Clearly describe the issue:
- If it is a bug, please describe how to **reproduce** it. If possible, attach a complete example which demonstrates the error. Please also state what you **expected** to happen instead of the error.
- If you propose a change or addition, try to give an **example** how the improved code could look like or how to use it.
- If you found a compilation error, please tell us which **compiler** (version and operating system) you used and paste the (relevant part of) the error messages to the ticket.
- If it is a bug, please describe how to **reproduce** it. If possible, attach a _complete example_ which demonstrates
the error. Please also state what you **expected** to happen instead of the error.
- If you propose a change or addition, try to give an **example** what the improved code could look like or how to use
it.
- If you found a compilation error, please tell us which **compiler** (version and operating system) you used and paste
the (relevant part of) the error messages to the ticket.
Please stick to the provided issue templates ([bug report](https://github.com/nlohmann/json/blob/develop/.github/ISSUE_TEMPLATE/Bug_report.md), [feature request](https://github.com/nlohmann/json/blob/develop/.github/ISSUE_TEMPLATE/Feature_request.md), or [question](https://github.com/nlohmann/json/blob/develop/.github/ISSUE_TEMPLATE/question.md)) if possible.
Please stick to the provided issue template
[bug report](https://github.com/nlohmann/json/blob/develop/.github/ISSUE_TEMPLATE/bug.yaml) if possible.
## Files to change
### Reporting a security vulnerability
:exclamation: Before you make any changes, note the single-header file [`single_include/nlohmann/json.hpp`](https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json.hpp) is **generated** from the source files in the [`include/nlohmann` directory](https://github.com/nlohmann/json/tree/develop/include/nlohmann). Please **do not** edit file `single_include/nlohmann/json.hpp` directly, but change the `include/nlohmann` sources and regenerate file `single_include/nlohmann/json.hpp` by executing `make amalgamate`.
You can report a security vulnerability according to our
To make changes, you need to edit the following files:
### Discussing a new feature
1. [`include/nlohmann/*`](https://github.com/nlohmann/json/tree/develop/include/nlohmann) - These files are the sources of the library. Before testing or creating a pull request, execute `make amalgamate` to regenerate `single_include/nlohmann/json.hpp`.
For questions, feature or support requests, please
[open a discussion](https://github.com/nlohmann/json/discussions/new). If you find a proposed answer satisfactory,
please use the "Mark as answer" button to make it easier for readers to see what helped and for the community to filter
for open questions.
2. [`test/src/unit-*.cpp`](https://github.com/nlohmann/json/tree/develop/test/src) - These files contain the [doctest](https://github.com/onqtam/doctest) unit tests which currently cover [100 %](https://coveralls.io/github/nlohmann/json) of the library's code.
### Proposing a fix or an improvement
If you add or change a feature, please also add a unit test to this file. The unit tests can be compiled and executed with
Join an ongoing discussion or comment on an existing issue before starting to code. This can help to avoid duplicate
efforts or other frustration during the later review.
```sh
$ mkdir build
$ cd build
$ cmake ..
$ cmake --build .
$ ctest
```
Create a [pull request](https://github.com/nlohmann/json/pulls?q=sort%3Aupdated-desc+is%3Apr+is%3Aopen) against the
`develop` branch and follow the pull request template. In particular,
The test cases are also executed with several different compilers on [Travis](https://travis-ci.org/nlohmann/json) once you open a pull request.
- describe the changes in detail, both the what and why,
- reference existing issues where applicable,
- add tests to maintain 100% test coverage,
- update the documentation as needed, and
- ensure the source code is amalgamated.
We describe all points in detail below.
## Note
All contributions (including pull requests) must agree to the
[Developer Certificate of Origin (DCO) version 1.1](https://developercertificate.org). This is exactly the same one
created and used by the Linux kernel developers and posted on http://developercertificate.org/. This is a developer's
certification that he or she has the right to submit the patch for inclusion into the project.
- If you open a pull request, the code will be automatically tested with [Valgrind](http://valgrind.org)'s Memcheck tool to detect memory leaks. Please be aware that the execution with Valgrind _may_ in rare cases yield different behavior than running the code directly. This can result in failing unit tests which run successfully without Valgrind.
- There is a Makefile target `make pretty` which runs [Artistic Style](http://astyle.sourceforge.net) to fix indentation. If possible, run it before opening the pull request. Otherwise, we shall run it afterward.
## How to...
## Please don't
### Describe your changes
- The C++11 support varies between different **compilers** and versions. Please note the [list of supported compilers](https://github.com/nlohmann/json/blob/master/README.md#supported-compilers). Some compilers like GCC 4.7 (and earlier), Clang 3.3 (and earlier), or Microsoft Visual Studio 13.0 and earlier are known not to work due to missing or incomplete C++11 support. Please refrain from proposing changes that work around these compiler's limitations with `#ifdef`s or other means.
- Specifically, I am aware of compilation problems with **Microsoft Visual Studio** (there even is an [issue label](https://github.com/nlohmann/json/issues?utf8=✓&q=label%3A%22visual+studio%22+) for these kind of bugs). I understand that even in 2016, complete C++11 support isn't there yet. But please also understand that I do not want to drop features or uglify the code just to make Microsoft's sub-standard compiler happy. The past has shown that there are ways to express the functionality such that the code compiles with the most recent MSVC - unfortunately, this is not the main objective of the project.
- Please refrain from proposing changes that would **break [JSON](https://json.org) conformance**. If you propose a conformant extension of JSON to be supported by the library, please motivate this extension.
- We shall not extend the library to **support comments**. There is quite some [controversy](https://www.reddit.com/r/programming/comments/4v6chu/why_json_doesnt_support_comments_douglas_crockford/) around this topic, and there were quite some [issues](https://github.com/nlohmann/json/issues/376) on this. We believe that JSON is fine without comments.
- We do not preserve the **insertion order of object elements**. The [JSON standard](https://tools.ietf.org/html/rfc8259.html) defines objects as "an unordered collection of zero or more name/value pairs". To this end, this library does not preserve insertion order of name/value pairs. (In fact, keys will be traversed in alphabetical order as `std::map` with `std::less` is used by default.) Note this behavior conforms to the standard, and we shall not change it to any other order. If you do want to preserve the insertion order, you can specialize the object type with containers like [`tsl::ordered_map`](https://github.com/Tessil/ordered-map) or [`nlohmann::fifo_map`](https://github.com/nlohmann/fifo_map).
This library is primarily maintained as a spare-time project. As such, I cannot make any guarantee how quickly changes
are merged and released. Therefore, it is very important to make the review as smooth as possible by explaining not only
_what_ you changed, but _why_. This rationale can be very valuable down the road when improvements or bugs are discussed
years later.
- Please do not open pull requests that address **multiple issues**.
### Reference an existing issue
[Link a pull request to an issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue)
to clarify that a fix is forthcoming and which issue can be closed after merging. Only a few cases (e.g., fixing typos)
do not require prior discussions.
### Write tests
The library has an extensive test suite that currently covers [100 %](https://coveralls.io/github/nlohmann/json) of the
library's code. These tests are crucial to maintain API stability and give future contributors confidence that they do
not accidentally break things. As Titus Winters aptly put it:
> If you liked it, you should have put a test on it.
#### Run the tests
First, ensure the test suite runs before making any changes:
```sh
$ cmake -S. -B build
$ cmake --build build -j 10
$ ctest --test-dir build -j 10
```
The test suite should report:
```
100% tests passed, 0 tests failed out of 98
```
#### Add tests
The tests are located in [`tests/src/unit-*.cpp`](https://github.com/nlohmann/json/tree/develop/tests/src) and contain
[doctest assertions](https://github.com/doctest/doctest/blob/master/doc/markdown/assertions.md) like `CHECK`. The tests
are structured along the features of the library or the nature of the tests. Usually, it should be clear from the
context which existing file needs to be extended, and only very few cases require creating new test files.
When fixing a bug, edit `unit-regression2.cpp` and add a section referencing the fixed issue.
#### Exceptions
When you test exceptions, please use `CHECK_THROWS_WITH_AS` which also takes the `what()` argument of the thrown
exception into account.
#### Coverage
If test coverage decreases, an automatic warning comment will be posted on the pull request. You can access a code
coverage report as an artifact to the “Ubuntu” workflow.
### Update the documentation
The [main documentation](https://json.nlohmann.me) of the library is generated from the files
[`docs/mkdocs/docs`](https://github.com/nlohmann/json/blob/develop/docs/mkdocs/docs). This folder contains dedicated
pages for [certain features](https://github.com/nlohmann/json/tree/develop/docs/mkdocs/docs/features), a list of
[all exceptions](https://github.com/nlohmann/json/blob/develop/docs/mkdocs/docs/home/exceptions.md), and
[extensive API documentation](https://github.com/nlohmann/json/tree/develop/docs/mkdocs/docs/api) with details on every
public API function.
Build the documentation locally using:
```shell
make install_venv -C docs/mkdocs
make serve -C docs/mkdocs
```
The documentation will then be available at <http://127.0.0.1:8000/>. See the documentation of
[mkdocs](https://www.mkdocs.org) and [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) for more
information.
### Amalgamate the source code
The single-header files
[`single_include/nlohmann/json.hpp`](https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json.hpp) and
[`include/nlohmann` directory](https://github.com/nlohmann/json/tree/develop/include/nlohmann). **Do not** edit the
files directly; instead, modify the include/nlohmann sources and regenerate the files by executing:
```shell
make amalgamate
```
## Recommended documentation
- The library’s [README file](https://github.com/nlohmann/json/blob/master/README.md) is an excellent starting point to
understand its functionality.
- The [documentation page](https://json.nlohmann.me) is the reference documentation of the library.
- [RFC 8259](https://datatracker.ietf.org/doc/html/rfc8259) is the reference for the JavaScript Object Notation (JSON)
Data Interchange Format.
## Please don't...
Certain contributions are not helpful.
### Break the public API
We take pride in the library being used by
[numerous customers across various industries](https://json.nlohmann.me/home/customers/). They all rely on the
guarantees provided by [semantic versioning](https://semver.org). Please do not change the library such that the public
API of the 3.x.y version is broken. This includes:
- Changing function signatures (altering parameter types, return types, number of parameters) or changing the const-ness
of member functions.
- Removing functions.
- Renaming functions or classes.
- Changing exception handling.
- Changing exception ids.
- Changing access specifiers.
- Changing default arguments.
Although these guidelines may seem restrictive, they are essential for maintaining the library’s utility.
Breaking changes may be introduced when they are guarded with a feature macro such as
[`JSON_USE_IMPLICIT_CONVERSIONS`](https://json.nlohmann.me/api/macros/json_use_implicit_conversions/) which allows
selectively changing the behavior of the library. In next steps, the current behavior can then be deprecated. Using
feature macros then allows users to test their code against the library in the next major release.
### Break C++11 language conformance
This library is designed to work with C++11 and later. This means that any
[supported C++11 compiler](https://github.com/nlohmann/json/blob/master/README.md#supported-compilers) should compile
the library without problems. Some compilers like GCC 4.7 (and earlier), Clang 3.3 (and earlier), or Microsoft Visual
Studio 13.0 and earlier are known not to work due to missing or incomplete C++11 support.
Please do not add features that do not work with the mentioned supported compilers. Please guard features from C++14 and
later against the respective [`JSON_HAS_CPP_14`](https://json.nlohmann.me/api/macros/json_has_cpp_11/) macros.
### Break JSON conformance
Please refrain from proposing changes that would **break [JSON](https://datatracker.ietf.org/doc/html/rfc8259)
conformance**. If you propose a conformant extension of JSON to be supported by the library, please motivate this
extension.
## Wanted
The following areas really need contribution:
The following areas really need contribution and are always welcomed:
- Extending the **continuous integration** toward more exotic compilers such as Android NDK, Intel's Compiler, or the bleeding-edge versions Clang.
- Improving the efficiency of the **JSON parser**. The current parser is implemented as a naive recursive descent parser with hand coded string handling. More sophisticated approaches like LALR parsers would be really appreciated. That said, parser generators like Bison or ANTLR do not play nice with single-header files -- I really would like to keep the parser inside the `json.hpp` header, and I am not aware of approaches similar to [`re2c`](http://re2c.org) for parsing.
- Extending and updating existing **benchmarks** to include (the most recent version of) this library. Though efficiency is not everything, speed and memory consumption are very important characteristics for C++ developers, so having proper comparisons would be interesting.
- Extending the **continuous integration** toward more exotic compilers such as Android NDK, Intel's Compiler, or the
bleeding-edge versions Clang.
- Improving the efficiency of the **JSON parser**. The current parser is implemented as a naive recursive descent parser
with hand-coded string handling. More sophisticated approaches like LALR parsers would be really appreciated. That
said, parser generators like Bison or ANTLR do not play nice with single-header files -- I really would like to keep
the parser inside the `json.hpp` header, and I am not aware of approaches similar to [`re2c`](http://re2c.org) for
parsing.
- Extending and updating existing **benchmarks** to include (the most recent version of) this library. Though efficiency
is not everything, speed and memory consumption are very important characteristics for C++ developers, so having
proper comparisons would be interesting.
We look forward to your contributions and collaboration to enhance the library!
[Describe your pull request here. Please read the text below the line, and make sure you follow the checklist.]
[Describe your pull request here. Please read the text below the line and make sure you follow the checklist.]
* * *
## Pull request checklist
- [ ] The changes are described in detail, both the what and why.
- [ ] If applicable, an [existing issue](https://github.com/nlohmann/json/issues) is referenced.
- [ ] The [Code coverage](https://coveralls.io/github/nlohmann/json) remained at 100%. A test case for every new line of code.
- [ ] If applicable, the [documentation](https://json.nlohmann.me) is updated.
- [ ] The source code is amalgamated by running `make amalgamate`.
Read the [Contribution Guidelines](https://github.com/nlohmann/json/blob/develop/.github/CONTRIBUTING.md) for detailed information.
- [ ] Changes are described in the pull request, or an [existing issue is referenced](https://github.com/nlohmann/json/issues).
- [ ] The test suite [compiles and runs](https://github.com/nlohmann/json/blob/develop/README.md#execute-unit-tests) without error.
- [ ] [Code coverage](https://coveralls.io/github/nlohmann/json) is 100%. Test cases can be added by editing the [test suite](https://github.com/nlohmann/json/tree/develop/test/src).
- [ ] The source code is amalgamated; that is, after making changes to the sources in the `include/nlohmann` directory, run `make amalgamate` to create the single-header file `single_include/nlohmann/json.hpp`. The whole process is described [here](https://github.com/nlohmann/json/blob/develop/.github/CONTRIBUTING.md#files-to-change).
## Please don't
- The C++11 support varies between different **compilers** and versions. Please note the [list of supported compilers](https://github.com/nlohmann/json/blob/master/README.md#supported-compilers). Some compilers like GCC 4.7 (and earlier), Clang 3.3 (and earlier), or Microsoft Visual Studio 13.0 and earlier are known not to work due to missing or incomplete C++11 support. Please refrain from proposing changes that work around these compiler's limitations with `#ifdef`s or other means.
- Specifically, I am aware of compilation problems with **Microsoft Visual Studio** (there even is an [issue label](https://github.com/nlohmann/json/issues?utf8=✓&q=label%3A%22visual+studio%22+) for these kind of bugs). I understand that even in 2016, complete C++11 support isn't there yet. But please also understand that I do not want to drop features or uglify the code just to make Microsoft's sub-standard compiler happy. The past has shown that there are ways to express the functionality such that the code compiles with the most recent MSVC - unfortunately, this is not the main objective of the project.
- Please refrain from proposing changes that would **break [JSON](https://json.org) conformance**. If you propose a conformant extension of JSON to be supported by the library, please motivate this extension.
- Please do not open pull requests that address **multiple issues**.
Usually, all issues are tracked publicly on [GitHub](https://github.com/nlohmann/json/issues). If you want to make a private report (e.g., for a vulnerability or to attach an example that is not meant to be published), please send an email to <mail@nlohmann.me>. You can use [this key](https://keybase.io/nlohmann/pgp_keys.asc?fingerprint=797167ae41c0a6d9232e48457f3cea63ae251b69) for encryption.
We value the security of our users and appreciate your efforts to responsibly disclose vulnerabilities. If you have
identified a security vulnerability in this repository, please use the GitHub Security Advisory
["Report a Vulnerability"](https://github.com/nlohmann/json/security/advisories/new) tab.
Until it is published, this draft security advisory will only be visible to the maintainers of this project. Other
users and teams may be added once the advisory is created.
We will send a response indicating the next steps in handling your report. After the initial reply to your report, we
will keep you informed of the progress towards a fix and full announcement and may ask for additional information or
guidance.
For vulnerabilities in third-party dependencies or modules, please report them directly to the respective maintainers.
## Additional Resources
- Explore security-related topics and contribute to tools and projects through
Please be sure to review the [code of conduct](https://github.com/nlohmann/json/blob/develop/CODE_OF_CONDUCT.md) and be respectful of other users. cc/ @nlohmann
Please be sure to review the [code of conduct](https://github.com/nlohmann/json/blob/develop/.github/CODE_OF_CONDUCT.md) and be respectful of other users. cc/ @nlohmann
# Configuration for request-info - https://github.com/behaviorbot/request-info
@ -17,3 +17,6 @@ requestInfoReplyComment: >
# *OPTIONAL* Label to be added to Issues and Pull Requests with insufficient information given
stale-issue-message:'This issue has been marked as stale because it has been open for 90 days without activity. If this issue is still relevant, please add a comment or remove the "stale" label. Otherwise, it will be closed in 10 days. Thank you for helping us prioritize our work!'
stale-pr-message:'This pull request has been marked as stale because it has had no activity for 30 days. While we won’t close it automatically, we encourage you to update or comment if it is still relevant. Keeping pull requests active and up-to-date helps us review and merge changes more efficiently. Thank you for your contributions!'
close-issue-message:'This issue has been closed after being marked as stale for 10 days without any further activity. If this was done in error or the issue is still relevant, please feel free to reopen it or create a new issue. We appreciate your understanding and contributions.'
- Impossible de read json file create with nlohmann::ordered\_json::dump [\#4556](https://github.com/nlohmann/json/issues/4556)
- Error C2039 : 'json\_sax\_dom\_callback\_parser': is not a member of 'nlohmann::json\_abi\_v3\_11\_3::detail' [\#4529](https://github.com/nlohmann/json/issues/4529)
- `json_fwd.hpp` don't define default template arguments for ordered\_map [\#4518](https://github.com/nlohmann/json/issues/4518)
- new repo version seems stop create any the ingress-nginx controller with opentelemetry-cpp.git [\#4515](https://github.com/nlohmann/json/issues/4515)
- Library Cannot Parse JSON File It Wrote [\#4448](https://github.com/nlohmann/json/issues/4448)
- Unexpected Integer Conversion of JSON Values on ARM64 [\#4447](https://github.com/nlohmann/json/issues/4447)
- Structure declared in natvis file template doesn't seem to match current structure of `basic_json<>` [\#4438](https://github.com/nlohmann/json/issues/4438)
- A lot of EOT in json file [\#4436](https://github.com/nlohmann/json/issues/4436)
- Failing to read complex Unicode string embedded in JSON [\#4417](https://github.com/nlohmann/json/issues/4417)
- Unable to parse JSON string from snake case to camel case [\#4399](https://github.com/nlohmann/json/issues/4399)
- Crashes when I try to use ‘json::at\(\)’ on a properly structured, non null, and correctly constructed ‘.json’ file [\#4387](https://github.com/nlohmann/json/issues/4387)
- JSON\_BuildTests fail when JSON\_DisableEnumSerialization is set to ON [\#4384](https://github.com/nlohmann/json/issues/4384)
- JSON can't parse a simple data [\#4383](https://github.com/nlohmann/json/issues/4383)
- \[json.exception.parse\_error.101\] parse error at line 1, column 4520: syntax error while parsing value - invalid string: forbidden character after backslash; last read: '".\? [\#4352](https://github.com/nlohmann/json/issues/4352)
- Compiler warning 'array-bounds' on g++12.2.0 on Ubuntu 22.10 kinetic with RelWithDebugInfo [\#3808](https://github.com/nlohmann/json/issues/3808)
- The MSVC team recently test JSON project failed to run test on release configuration on windows\_x64. [\#3542](https://github.com/nlohmann/json/issues/3542)
- Bad JSON diff when removing object in array of object [\#3146](https://github.com/nlohmann/json/issues/3146)
- Limit AppVeyor use [\#3089](https://github.com/nlohmann/json/issues/3089)
- pkgconfig integration wrongly rendered if tests are run [\#2907](https://github.com/nlohmann/json/issues/2907)
- Compile error for json in template and variadic macros. [\#2794](https://github.com/nlohmann/json/issues/2794)
- How to Serialize derived class to JSON object? [\#2199](https://github.com/nlohmann/json/issues/2199)
- \[C++17\] Allow std::optional to convert to nlohmann::json [\#1749](https://github.com/nlohmann/json/issues/1749)
- Fix typo in nlohmann\_define\_derived\_type.md [\#4565](https://github.com/nlohmann/json/pull/4565) ([gregmarr](https://github.com/gregmarr))
- Add ONLY\_SERIALIZE for NLOHMANN\_DEFINE\_DERIVED\_TYPE\_\* macros [\#4562](https://github.com/nlohmann/json/pull/4562) ([EinarsNG](https://github.com/EinarsNG))
- Bump actions/upload-artifact from 4.4.3 to 4.5.0 [\#4557](https://github.com/nlohmann/json/pull/4557) ([dependabot[bot]](https://github.com/apps/dependabot))
- Clean up CI [\#4553](https://github.com/nlohmann/json/pull/4553) ([nlohmann](https://github.com/nlohmann))
- Add step to build the documentation [\#4549](https://github.com/nlohmann/json/pull/4549) ([nlohmann](https://github.com/nlohmann))
- Bump mkdocs-material from 9.5.48 to 9.5.49 in /docs/mkdocs [\#4548](https://github.com/nlohmann/json/pull/4548) ([dependabot[bot]](https://github.com/apps/dependabot))
- Move reuse dependency to requirements.txt file [\#4547](https://github.com/nlohmann/json/pull/4547) ([nlohmann](https://github.com/nlohmann))
- Clean up [\#4546](https://github.com/nlohmann/json/pull/4546) ([nlohmann](https://github.com/nlohmann))
- ⬆️ Bump ossf/scorecard-action from 2.3.3 to 2.4.0 [\#4545](https://github.com/nlohmann/json/pull/4545) ([dependabot[bot]](https://github.com/apps/dependabot))
- ⬆️ Bump lukka/get-cmake from 3.31.0 to 3.31.2 [\#4544](https://github.com/nlohmann/json/pull/4544) ([dependabot[bot]](https://github.com/apps/dependabot))
- ⬆️ Bump github/codeql-action from 2.27.9 to 3.27.9 [\#4543](https://github.com/nlohmann/json/pull/4543) ([dependabot[bot]](https://github.com/apps/dependabot))
- ⬆️ Bump watchdog from 2.1.7 to 6.0.0 in /tools/serve\_header [\#4542](https://github.com/nlohmann/json/pull/4542) ([dependabot[bot]](https://github.com/apps/dependabot))
- ⬆️ Bump pyyaml from 6.0 to 6.0.2 in /tools/serve\_header [\#4541](https://github.com/nlohmann/json/pull/4541) ([dependabot[bot]](https://github.com/apps/dependabot))
- ⬆️ Bump actions/github-script from 6.4.0 to 7.0.1 [\#4540](https://github.com/nlohmann/json/pull/4540) ([dependabot[bot]](https://github.com/apps/dependabot))
- \[StepSecurity\] Apply security best practices [\#4539](https://github.com/nlohmann/json/pull/4539) ([step-security-bot](https://github.com/step-security-bot))
- Set parents after insert call [\#4537](https://github.com/nlohmann/json/pull/4537) ([nlohmann](https://github.com/nlohmann))
- Allow patch and diff to be used with arbitrary string types [\#4536](https://github.com/nlohmann/json/pull/4536) ([nlohmann](https://github.com/nlohmann))
- Add more package managers [\#4533](https://github.com/nlohmann/json/pull/4533) ([nlohmann](https://github.com/nlohmann))
- Replace EOF with char\_traits [\#4532](https://github.com/nlohmann/json/pull/4532) ([nlohmann](https://github.com/nlohmann))
- Fix return value of get\_ptr for unsigned integers [\#4525](https://github.com/nlohmann/json/pull/4525) ([nlohmann](https://github.com/nlohmann))
- Add more GCC warning flags [\#4524](https://github.com/nlohmann/json/pull/4524) ([nlohmann](https://github.com/nlohmann))
- fix: integer parsed as float when EINTR set in errno [\#4506](https://github.com/nlohmann/json/pull/4506) ([StuartGorman](https://github.com/StuartGorman))
- Make SAX output locale-independent [\#4505](https://github.com/nlohmann/json/pull/4505) ([nlohmann](https://github.com/nlohmann))
- Skip enum tests when JSON\_DisableEnumSerialization=ON [\#4504](https://github.com/nlohmann/json/pull/4504) ([nlohmann](https://github.com/nlohmann))
- Add CPack support [\#4459](https://github.com/nlohmann/json/pull/4459) ([zjyhjqs](https://github.com/zjyhjqs))
- CMake: generate a pkg-config file that follow pkg-config conventions [\#4456](https://github.com/nlohmann/json/pull/4456) ([dcbaker](https://github.com/dcbaker))
- Update natvis to reflect 3.11.3 and the current structure of basic\_json [\#4451](https://github.com/nlohmann/json/pull/4451) ([gmyers18](https://github.com/gmyers18))
- Docs: fix typos of 'whether' in `operator_{gt,le,lt}.md` [\#4412](https://github.com/nlohmann/json/pull/4412) ([tsnl](https://github.com/tsnl))
- Remove alwayslink=True Bazel flag [\#4396](https://github.com/nlohmann/json/pull/4396) ([mering](https://github.com/mering))
- Optimize binary `get_number` implementation by reading multiple bytes at once [\#4391](https://github.com/nlohmann/json/pull/4391) ([TianyiChen](https://github.com/TianyiChen))
- Make iterator\_proxy\_value a forward\_iterator \(\#4371\) [\#4372](https://github.com/nlohmann/json/pull/4372) ([captaincrutches](https://github.com/captaincrutches))
- Fix for incorrect function name in documentation example [\#4342](https://github.com/nlohmann/json/pull/4342) ([alexprabhat99](https://github.com/alexprabhat99))
- Fixed an error in the `Custom data source` example. [\#4335](https://github.com/nlohmann/json/pull/4335) ([philip-paul-mueller](https://github.com/philip-paul-mueller))
- Updated exception handling to catch const reference in out\_of\_range [\#4331](https://github.com/nlohmann/json/pull/4331) ([LeilaShcheglova](https://github.com/LeilaShcheglova))
- \#4307 Updated docx to 3.10.5 from 3.10.4 [\#4310](https://github.com/nlohmann/json/pull/4310) ([AniketDhemare](https://github.com/AniketDhemare))
- Align astyle flags in Makefile with CI [\#4277](https://github.com/nlohmann/json/pull/4277) ([serge-s](https://github.com/serge-s))
- Remove broken link from CONTRIBUTING.md [\#4274](https://github.com/nlohmann/json/pull/4274) ([serge-s](https://github.com/serge-s))
- Fix version in json\_has\_static\_rtti.md [\#4269](https://github.com/nlohmann/json/pull/4269) ([ALF-ONE](https://github.com/ALF-ONE))
- Add support of multi-dim C-style array member of struct. [\#4262](https://github.com/nlohmann/json/pull/4262) ([peng-wang-cn](https://github.com/peng-wang-cn))
- Docs: Fix wrong code usage in the Value access section of `json_pointer.md` [\#4255](https://github.com/nlohmann/json/pull/4255) ([Fallen-Breath](https://github.com/Fallen-Breath))
- Fix `to_json` for enums when the enum has an unsigned underlying type. [\#4237](https://github.com/nlohmann/json/pull/4237) ([TheJCAB](https://github.com/TheJCAB))
- feat: Rebase `feature/optional` to `develop` [\#4036](https://github.com/nlohmann/json/pull/4036) ([fsandhei](https://github.com/fsandhei))
- Parser and constructor resolve integer types differently [\#4207](https://github.com/nlohmann/json/issues/4207)
- README.md overuses `template` keyword before `get` function [\#4205](https://github.com/nlohmann/json/issues/4205)
- Exception SIGSEGV - Segmentation violation signal on file parsing \(v3.11.2, linux, doctest\) [\#4193](https://github.com/nlohmann/json/issues/4193)
- In highly nested functions, passing json into a function leads to a segmentation fault/bus error [\#4186](https://github.com/nlohmann/json/issues/4186)
- why a single-object json file appears in an array [\#4183](https://github.com/nlohmann/json/issues/4183)
- Initializing `json` by direct initialization and copy initialization invokes different constructors [\#4174](https://github.com/nlohmann/json/issues/4174)
- Deprecation warning about std::char\_traits\<unsigned char\> [\#4163](https://github.com/nlohmann/json/issues/4163)
- LLVM 16.0.6 issues warning for literal operators when Wdeprecated-literal-operator [\#4129](https://github.com/nlohmann/json/issues/4129)
- GCC compiler warning about violating the C++ One Definition Rule \[-Wodr\] [\#4116](https://github.com/nlohmann/json/issues/4116)
- error: building nlohmann-json:arm64-osx failed with: BUILD\_FAILED [\#4091](https://github.com/nlohmann/json/issues/4091)
- dump\(\): Non-conforming with JSON-spec escape of strings? [\#4088](https://github.com/nlohmann/json/issues/4088)
- Compiling in visual studio 2022 gives a warning [\#4081](https://github.com/nlohmann/json/issues/4081)
- Upgrade CMake minimum version [\#4076](https://github.com/nlohmann/json/issues/4076)
- \ character in the content of a string cause error in parser.? [\#4067](https://github.com/nlohmann/json/issues/4067)
- JSON Parsing Freeze Issue on Nintendo Switch [\#4066](https://github.com/nlohmann/json/issues/4066)
- Clang++ compilation fails on extremely small example [\#4061](https://github.com/nlohmann/json/issues/4061)
- how about open a new repository for header only version? [\#4060](https://github.com/nlohmann/json/issues/4060)
- json::count returns only 0 or 1 [\#4052](https://github.com/nlohmann/json/issues/4052)
- try/catch block doesn't work while accessing const json& array. [\#3998](https://github.com/nlohmann/json/issues/3998)
- a bug about list [\#3995](https://github.com/nlohmann/json/issues/3995)
- heap corruption when i use nlohmann::json::accept function to check a valid json [\#3994](https://github.com/nlohmann/json/issues/3994)
- Exception on gcc but not apple clang [\#3986](https://github.com/nlohmann/json/issues/3986)
- Can't support convert the type? std::string json\_str = R"\({"value": "3.1415"}\)"; float value = j\["value"\].get\<float\>\(\); [\#3984](https://github.com/nlohmann/json/issues/3984)
- `#pragma once` not supported with C++20 modules in clang [\#3974](https://github.com/nlohmann/json/issues/3974)
- const array\_t::operator\[\] results in buffer overflow / segv on nullptr on out of bounds access [\#3973](https://github.com/nlohmann/json/issues/3973)
- Set minimal permissions to Github Workflows [\#3971](https://github.com/nlohmann/json/issues/3971)
- why I can return tuple as json? [\#3961](https://github.com/nlohmann/json/issues/3961)
- type must be number, but is null [\#3956](https://github.com/nlohmann/json/issues/3956)
- Class Composition of json members produces incorrect json when constructing with initialization list [\#3955](https://github.com/nlohmann/json/issues/3955)
- exit without error message [\#3948](https://github.com/nlohmann/json/issues/3948)
- NLOHMANN\_DEFINE\_TYPE\_INTRUSIVE doesn't work with "json\_fwd.hpp" [\#3946](https://github.com/nlohmann/json/issues/3946)
- Dangerous use of pull\_request\_target [\#3945](https://github.com/nlohmann/json/issues/3945)
- Test \#7: test-bjdata\_cpp11 ............................\*\*\*Failed [\#3941](https://github.com/nlohmann/json/issues/3941)
- Memory leak detection with basic usage of NLOHMANN\_JSON\_SERIALIZE\_ENUM [\#3939](https://github.com/nlohmann/json/issues/3939)
- Parse doesnt work [\#3936](https://github.com/nlohmann/json/issues/3936)
- Clean up badges [\#3935](https://github.com/nlohmann/json/issues/3935)
- \[json.exception.type\_error.305\] cannot use operator\[\] with a string argument with array [\#3931](https://github.com/nlohmann/json/issues/3931)
- \[json.exception.parse\_error.101\] parse error at line 1, column 1: syntax error while parsing value - unexpected end of input; expected '\[', '{', or a literal [\#3882](https://github.com/nlohmann/json/issues/3882)
- Memory leak when exception is thrown in adl\_serializer::to\_json [\#3881](https://github.com/nlohmann/json/issues/3881)
- building with cmake [\#3880](https://github.com/nlohmann/json/issues/3880)
- \[json.exception.type\_error.316\] invalid UTF-8 byte at index 0: 0xB6 [\#3879](https://github.com/nlohmann/json/issues/3879)
- Visual Studio 2015 C2664 error std::pair\< [\#3867](https://github.com/nlohmann/json/issues/3867)
- I want the data field to be empty serialized and deserialized to each other [\#3866](https://github.com/nlohmann/json/issues/3866)
- Generated natvis is invalid XML [\#3858](https://github.com/nlohmann/json/issues/3858)
- Json Arrays have inconsistent nesting levels across different OSs [\#3854](https://github.com/nlohmann/json/issues/3854)
- Occur error when parse character '\' [\#3844](https://github.com/nlohmann/json/issues/3844)
- Proccess crash as soon as I parse json [\#3843](https://github.com/nlohmann/json/issues/3843)
- json::parse and constructor with the same json generates different type [\#3842](https://github.com/nlohmann/json/issues/3842)
- json::accept return false on valid JSON [\#3838](https://github.com/nlohmann/json/issues/3838)
- Arithmetic operators are not working as expected [\#3832](https://github.com/nlohmann/json/issues/3832)
- array\_index does not catch std::invalid\_argument exception from std::stoull [\#3831](https://github.com/nlohmann/json/issues/3831)
- 3.11.2: test suite is failing in two units [\#3828](https://github.com/nlohmann/json/issues/3828)
- Compile Error on g++ using get\(\) function [\#3827](https://github.com/nlohmann/json/issues/3827)
- nlohmann::json::parse can't handle the "€" symbol. [\#3825](https://github.com/nlohmann/json/issues/3825)
- When reading a non-existent key, I unexpectedly get a value. Is it the wrong way I use it? [\#3811](https://github.com/nlohmann/json/issues/3811)
- Code analysis warning string\_concat.hpp C26800: Use of a moved from object [\#3805](https://github.com/nlohmann/json/issues/3805)
- The code used to build with 3.10.2 but fails now [\#3804](https://github.com/nlohmann/json/issues/3804)
- Inconsistent Behaviour of NaN & Null Values [\#3799](https://github.com/nlohmann/json/issues/3799)
- json\_fwd.hpp doesn't work [\#3796](https://github.com/nlohmann/json/issues/3796)
- Compilation fails in MSVC 22 [\#3787](https://github.com/nlohmann/json/issues/3787)
- parsing json with missing key throws exception [\#3784](https://github.com/nlohmann/json/issues/3784)
- Allow to disable inline namespaces completley [\#3746](https://github.com/nlohmann/json/issues/3746)
- double free or Assertion failed! [\#3729](https://github.com/nlohmann/json/issues/3729)
- Amalgated json\_fwd.hpp not included in include.zip [\#3727](https://github.com/nlohmann/json/issues/3727)
- INT64\_MIN/MAX not defined for newer g++ [\#3722](https://github.com/nlohmann/json/issues/3722)
- Compilation error with JSON\_DIAGNOSTICS enabled [\#3717](https://github.com/nlohmann/json/issues/3717)
- class-level enum not serialized as string via NLOHMANN\_JSON\_SERIALIZE\_ENUM [\#3715](https://github.com/nlohmann/json/issues/3715)
- Local copy given by operator\[\] or at\(\) [\#3704](https://github.com/nlohmann/json/issues/3704)
- nlohmann::to\_json method not acting as expected with nlohmann::adl\_serializer specialization. [\#3340](https://github.com/nlohmann/json/issues/3340)
- braced-init-list: array vs other constructor [\#2583](https://github.com/nlohmann/json/issues/2583)
- JSON for Modern C++ 3.11.3 [\#4222](https://github.com/nlohmann/json/pull/4222) ([nlohmann](https://github.com/nlohmann))
- Update documentation for the next release [\#4216](https://github.com/nlohmann/json/pull/4216) ([nlohmann](https://github.com/nlohmann))
- Fix failing CI checks [\#4215](https://github.com/nlohmann/json/pull/4215) ([colbychaskell](https://github.com/colbychaskell))
- Fix CI \(again\) [\#4196](https://github.com/nlohmann/json/pull/4196) ([nlohmann](https://github.com/nlohmann))
- fix cmake header path in install with custom CMAKE\_INSTALL\_INCLUDEDIR [\#4194](https://github.com/nlohmann/json/pull/4194) ([bebuch](https://github.com/bebuch))
- Add more specific error message when attempting to parse empty input [\#4180](https://github.com/nlohmann/json/pull/4180) ([colbychaskell](https://github.com/colbychaskell))
- Fix source highlighting in user defined type macros docs [\#4169](https://github.com/nlohmann/json/pull/4169) ([ZeronSix](https://github.com/ZeronSix))
- Correct a typo in serve\_header/README.md [\#4143](https://github.com/nlohmann/json/pull/4143) ([felixonmars](https://github.com/felixonmars))
- Fixed init-list construction when size\_type is not int [\#4140](https://github.com/nlohmann/json/pull/4140) ([tomalakgeretkal](https://github.com/tomalakgeretkal))
- Accept NEW CMake policies up to CMake 3.14 [\#4112](https://github.com/nlohmann/json/pull/4112) ([craigscott-crascit](https://github.com/craigscott-crascit))
- Fix typo in afl\_driver.cpp [\#4109](https://github.com/nlohmann/json/pull/4109) ([eltociear](https://github.com/eltociear))
- Capture exceptions by const& in docs. [\#4099](https://github.com/nlohmann/json/pull/4099) ([iwanders](https://github.com/iwanders))
- Fix CI, again [\#4083](https://github.com/nlohmann/json/pull/4083) ([nlohmann](https://github.com/nlohmann))
- Fix compile error with \_HAS\_STATIC\_RTTI=0 [\#4046](https://github.com/nlohmann/json/pull/4046) ([ALF-ONE](https://github.com/ALF-ONE))
- Add to CONTRIBUTING.md that `make pretty` is required for test updates. [\#4045](https://github.com/nlohmann/json/pull/4045) ([gregmarr](https://github.com/gregmarr))
- Added to tests the file unit-algorithm.cpp \(c++ 11\) functions from algorithm library [\#4044](https://github.com/nlohmann/json/pull/4044) ([Tomerkm](https://github.com/Tomerkm))
- Use template get instead of get in examples [\#4039](https://github.com/nlohmann/json/pull/4039) ([tusooa](https://github.com/tusooa))
- Support Apple's Swift Package Manager [\#4010](https://github.com/nlohmann/json/pull/4010) ([aleksproger](https://github.com/aleksproger))
- Add Vcpkg port version badge [\#3988](https://github.com/nlohmann/json/pull/3988) ([njakob](https://github.com/njakob))
- Fix CI + new Doctest [\#3985](https://github.com/nlohmann/json/pull/3985) ([nlohmann](https://github.com/nlohmann))
- Set minimal permissions to Github Workflows [\#3972](https://github.com/nlohmann/json/pull/3972) ([joycebrum](https://github.com/joycebrum))
- Refactor amalgamation workflow to avoid dangerous use of pull\_request\_target [\#3969](https://github.com/nlohmann/json/pull/3969) ([joycebrum](https://github.com/joycebrum))
- Fix typo in test.cmake [\#3951](https://github.com/nlohmann/json/pull/3951) ([theevilone45](https://github.com/theevilone45))
- tests/unit-iterators2: use std::ranges::equals for range comparisons [\#3950](https://github.com/nlohmann/json/pull/3950) ([ArsenArsen](https://github.com/ArsenArsen))
- 3935, removed lgtm badge and added Cirrus CI badge [\#3937](https://github.com/nlohmann/json/pull/3937) ([haadfida](https://github.com/haadfida))
- ⬆️ Bump future from 0.18.2 to 0.18.3 in /docs/mkdocs [\#3934](https://github.com/nlohmann/json/pull/3934) ([dependabot[bot]](https://github.com/apps/dependabot))
- Change 2022 to 2023 [\#3932](https://github.com/nlohmann/json/pull/3932) ([floriansegginger](https://github.com/floriansegginger))
- PrettyPrinter: Check if match is valid before accessing group [\#3920](https://github.com/nlohmann/json/pull/3920) ([Finkman](https://github.com/Finkman))
- Fix CI issues [\#3906](https://github.com/nlohmann/json/pull/3906) ([barcode](https://github.com/barcode))
- Prevent memory leak when exception is thrown in adl\_serializer::to\_json [\#3901](https://github.com/nlohmann/json/pull/3901) ([barcode](https://github.com/barcode))
- custom allocators: define missing 'rebind' type [\#3895](https://github.com/nlohmann/json/pull/3895) ([trofi](https://github.com/trofi))
- Try old MinGW script [\#3892](https://github.com/nlohmann/json/pull/3892) ([nlohmann](https://github.com/nlohmann))
- Bump certifi from 2022.6.15 to 2022.12.7 in /docs/mkdocs [\#3872](https://github.com/nlohmann/json/pull/3872) ([dependabot[bot]](https://github.com/apps/dependabot))
- Fix natvis XML [\#3863](https://github.com/nlohmann/json/pull/3863) ([nlohmann](https://github.com/nlohmann))
- Add CIFuzz CI GitHub action [\#3845](https://github.com/nlohmann/json/pull/3845) ([DavidKorczynski](https://github.com/DavidKorczynski))
- Add serialization-only user defined type macros [\#3816](https://github.com/nlohmann/json/pull/3816) ([ZeronSix](https://github.com/ZeronSix))
- Bump joblib from 1.1.0 to 1.2.0 in /docs/mkdocs [\#3781](https://github.com/nlohmann/json/pull/3781) ([dependabot[bot]](https://github.com/apps/dependabot))
- Fix some typos for n-dimensional arrays [\#3767](https://github.com/nlohmann/json/pull/3767) ([striezel](https://github.com/striezel))
- Fix 'declaration hides global declaration' warning [\#3751](https://github.com/nlohmann/json/pull/3751) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
- Fix typos in .md files [\#3748](https://github.com/nlohmann/json/pull/3748) ([tocic](https://github.com/tocic))
- Update Codacy link [\#3740](https://github.com/nlohmann/json/pull/3740) ([nlohmann](https://github.com/nlohmann))
- Add missing files to release artifacts [\#3728](https://github.com/nlohmann/json/pull/3728) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
- Add dark mode toggle to documentation [\#3726](https://github.com/nlohmann/json/pull/3726) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
- Add clang-tools to required tools for ci\_static\_analysis\_clang [\#3724](https://github.com/nlohmann/json/pull/3724) ([nlohmann](https://github.com/nlohmann))
- Replace limit macros with std::numeric\_limits [\#3723](https://github.com/nlohmann/json/pull/3723) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
- Add missing \<numeric\> include [\#3719](https://github.com/nlohmann/json/pull/3719) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
- Add Bazel build support [\#3709](https://github.com/nlohmann/json/pull/3709) ([Vertexwahn](https://github.com/Vertexwahn))
- Use official Clang/GCC containers [\#3703](https://github.com/nlohmann/json/pull/3703) ([nlohmann](https://github.com/nlohmann))
- generate\_natvis.py: validate version number; cleanup [\#3698](https://github.com/nlohmann/json/pull/3698) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
- Add Python script for generating Natvis file and update file for 3.11.2 [\#3697](https://github.com/nlohmann/json/pull/3697) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
- fix typo in json\_pointer.md [\#3692](https://github.com/nlohmann/json/pull/3692) ([eltociear](https://github.com/eltociear))
- Add amalgamated json-fwd.hpp to release [\#3687](https://github.com/nlohmann/json/pull/3687) ([nlohmann](https://github.com/nlohmann))
- Documentation updates for 3.11.2 [\#3686](https://github.com/nlohmann/json/pull/3686) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
- Make json\_pointer usable as map key \(again\) [\#3685](https://github.com/nlohmann/json/pull/3685) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
- Restructure inline namespace and allow version component to be disabled [\#3683](https://github.com/nlohmann/json/pull/3683) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
- Amalgamate the forward declaration header [\#3679](https://github.com/nlohmann/json/pull/3679) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
- Fix 'const' qualifier on bool& has no effect [\#3678](https://github.com/nlohmann/json/pull/3678) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
- Fix whitespace in workflow files [\#3675](https://github.com/nlohmann/json/pull/3675) ([nlohmann](https://github.com/nlohmann))
- Attempt to fix labeler permissions [\#3674](https://github.com/nlohmann/json/pull/3674) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
- Add license header to new files [\#3633](https://github.com/nlohmann/json/pull/3633) ([nlohmann](https://github.com/nlohmann))
- Add a unit test including windows.h [\#3631](https://github.com/nlohmann/json/pull/3631) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
- Fixed latest build error in msvc platform [\#3630](https://github.com/nlohmann/json/pull/3630) ([KsaNL](https://github.com/KsaNL))
- Fixed latest build error in msvc platform [\#3630](https://github.com/nlohmann/json/pull/3630) ([Lioncky](https://github.com/Lioncky))
- Add regression tests for \#3204 and \#3333 [\#3629](https://github.com/nlohmann/json/pull/3629) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
@ -138,7 +509,7 @@ All notable changes to this project will be documented in this file. This projec
- Use REUSE framework [\#3546](https://github.com/nlohmann/json/pull/3546) ([nlohmann](https://github.com/nlohmann))
- Use `std::iterator_traits` to extract `iterator_category` [\#3544](https://github.com/nlohmann/json/pull/3544) ([Mike-Leo-Smith](https://github.com/Mike-Leo-Smith))
- BJData dimension length can not be string\_t::npos, fix \#3541 [\#3543](https://github.com/nlohmann/json/pull/3543) ([fangq](https://github.com/fangq))
- Add to\_json\(\) for std::vector\<bool\>::reference [\#3534](https://github.com/nlohmann/json/pull/3534) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
- CI: Enable 32bit unit test \(3\) [\#3532](https://github.com/nlohmann/json/pull/3532) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
- Use new CI image [\#3528](https://github.com/nlohmann/json/pull/3528) ([nlohmann](https://github.com/nlohmann))
@ -599,7 +970,6 @@ All notable changes to this project will be documented in this file. This projec
- array\_index possible out of range [\#2205](https://github.com/nlohmann/json/issues/2205)
- Object deserialized as array [\#2204](https://github.com/nlohmann/json/issues/2204)
- Sending to a function a reference to a sub-branch [\#2200](https://github.com/nlohmann/json/issues/2200)
- How to Serialize derived class to JSON object? [\#2199](https://github.com/nlohmann/json/issues/2199)
- msgpack serialisation : float is treated as 64bit float, not 32bit float. [\#2196](https://github.com/nlohmann/json/issues/2196)
@ -632,7 +1002,6 @@ All notable changes to this project will be documented in this file. This projec
- Compilation failure using Clang on Windows [\#1898](https://github.com/nlohmann/json/issues/1898)
- Fail to build when including json.hpp as a system include [\#1818](https://github.com/nlohmann/json/issues/1818)
- Parsing string into json doesn't preserve the order correctly. [\#1817](https://github.com/nlohmann/json/issues/1817)
- \[C++17\] Allow std::optional to convert to nlohmann::json [\#1749](https://github.com/nlohmann/json/issues/1749)
- How can I save json object in file in order? [\#1717](https://github.com/nlohmann/json/issues/1717)
- Support for Comments [\#1513](https://github.com/nlohmann/json/issues/1513)
- clang compiler: error : unknown type name 'not' [\#1119](https://github.com/nlohmann/json/issues/1119)
@ -1652,7 +2021,7 @@ All notable changes to this project will be documented in this file. This projec
- Use a version check to provide backwards comatible CMake imported target names [\#1245](https://github.com/nlohmann/json/pull/1245) ([chuckatkins](https://github.com/chuckatkins))
@ -1819,8 +2188,8 @@ All notable changes to this project will be documented in this file. This projec
- Fix unit tests that were silently skipped or crashed \(depending on the compiler\) [\#1176](https://github.com/nlohmann/json/pull/1176) ([grembo](https://github.com/grembo))
- CMake: 3.8+ is Sufficient [\#1040](https://github.com/nlohmann/json/pull/1040) ([ax3l](https://github.com/ax3l))
@ -2358,7 +2727,7 @@ All notable changes to this project will be documented in this file. This projec
- Fix "not constraint" grammar in docs [\#674](https://github.com/nlohmann/json/pull/674) ([wincent](https://github.com/wincent))
- Add documentation for integration with CMake and hunter [\#671](https://github.com/nlohmann/json/pull/671) ([dan-42](https://github.com/dan-42))
- REFACTOR: rewrite CMakeLists.txt for better inlcude and reuse [\#669](https://github.com/nlohmann/json/pull/669) ([dan-42](https://github.com/dan-42))
- enable\_testing only if the JSON\_BuildTests is ON [\#666](https://github.com/nlohmann/json/pull/666) ([effolkronium](https://github.com/effolkronium))
- enable\_testing only if the JSON\_BuildTests is ON [\#666](https://github.com/nlohmann/json/pull/666) ([ilqvya](https://github.com/ilqvya))
- Support moving from rvalues in std::initializer\_list [\#663](https://github.com/nlohmann/json/pull/663) ([himikof](https://github.com/himikof))
- add ensure\_ascii parameter to dump. \#330 [\#654](https://github.com/nlohmann/json/pull/654) ([ryanjmulder](https://github.com/ryanjmulder))
- Rename BuildTests to JSON\_BuildTests [\#652](https://github.com/nlohmann/json/pull/652) ([olegendo](https://github.com/olegendo))
@ -2877,11 +3246,11 @@ All notable changes to this project will be documented in this file. This projec
- Keyword 'inline' is useless when member functions are defined in headers [\#87](https://github.com/nlohmann/json/pull/87) ([ahamez](https://github.com/ahamez))
- Replace `default_callback` function with `nullptr` and check for null… [\#72](https://github.com/nlohmann/json/pull/72) ([aburgh](https://github.com/aburgh))
- support enum [\#71](https://github.com/nlohmann/json/pull/71) ([likebeta](https://github.com/likebeta))
- Fix performance regression introduced with the parsing callback feature. [\#69](https://github.com/nlohmann/json/pull/69) ([aburgh](https://github.com/aburgh))
- Improve the implementations of the comparission-operators [\#63](https://github.com/nlohmann/json/pull/63) ([Florianjw](https://github.com/Florianjw))
- Improve the implementations of the comparission-operators [\#63](https://github.com/nlohmann/json/pull/63) ([Fiona-J-W](https://github.com/Fiona-J-W))
- Fix compilation of json\_unit with GCC 5 [\#59](https://github.com/nlohmann/json/pull/59) ([dkopecek](https://github.com/dkopecek))
This file describes the source for supporting files; that is, files that are not part of the library, but define the infrastructure and other aspects of the project.
> The filename `CITATION.cff` and position (root of the repository) are predetermined by GitHub.
### `.github/CODE_OF_CONDUCT.md`
The code of conduct for the project. This is the Markdown version of the [Contributor Covenant Code of Conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/). The code of conduct is linked on the [Community Standards](https://github.com/nlohmann/json/community) page and is mentioned by the Sentiment Bot.
Further documentation:
- [Adding a code of conduct to your project](https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/adding-a-code-of-conduct-to-your-project)
> [!IMPORTANT]
> The filename `.github/CODE_OF_CONDUCT.md` is predetermined by GitHub.
> [!NOTE]
> The file is part of the documentation and is included in `docs/mkdocs/docs/community/code_of_conduct.md`.
### `.github/CODEOWNERS`
The code owners file for the project which is used to select reviewers for new pull requests.
> The filename `.github/CODEOWNERS` is predetermined by GitHub.
### `.github/config.yml`
Configuration file for [probot](https://probot.github.io/apps/), in particular the [Sentiment Bot](https://probot.github.io/apps/sentiment-bot/) and the [Request Info](https://probot.github.io/apps/request-info/).
> [!IMPORTANT]
> The filename `.github/config.yml` is predetermined by probot.
### `.github/CONTRIBUTING.md`
The contribution guidelines which are linked in the [Community Standards](https://github.com/nlohmann/json/community) and at <https://github.com/nlohmann/json/contribute>.
Further documentation:
- [Setting guidelines for repository contributors](https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/setting-guidelines-for-repository-contributors)
> [!IMPORTANT]
> The filename `.github/CONTRIBUTING.md` is predetermined by GitHub.
> [!NOTE]
> The file is part of the documentation and is included in `docs/mkdocs/docs/community/contribution_guidelines.md`.
### `.github/dependabot.yml`
The configuration of [dependabot](https://github.com/dependabot) which ensures the dependencies (GitHub actions and Python packages used in the CI) remain up to date.
> The filename `.github/dependabot.yml` is predetermined by GitHub.
### `.github/FUNDING.yml`
A file to configure the sponsor button of the repository which is displayed in the sidebar of the project.
Further documentation:
- [Displaying a sponsor button in your repository](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/displaying-a-sponsor-button-in-your-repository)
> [!IMPORTANT]
> The filename `.github/FUNDING.yml` is predetermined by GitHub.
### `.github/ISSUE_TEMPLATE/bug.yaml`
Issue form template for bugs.
Further documentation:
- [Configuring issue templates for your repository](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository)
> [!IMPORTANT]
> The folder `.github/ISSUE_TEMPLATE` is predetermined by GitHub.
### `.github/ISSUE_TEMPLATE/config.yaml`
Issue template chooser configuration. The file is used to configure the dialog when a new issue is created.
Further documentation:
- [Configuring issue templates for your repository](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository)
> [!IMPORTANT]
> The filename `.github/ISSUE_TEMPLATE/config.yaml` is predetermined by GitHub.
### `.github/labeler.yml`
Configuration file for the "Pull Request Labeler" workflow defined in `workflows/labeler.yml`. This file defines rules how labels are assigned to pull requests based on which files are changed.
Further documentation:
- [Label manager for PRs and issues based on configurable conditions](https://github.com/srvaroa/labeler)
> [!NOTE]
> The filename defaults to `.github/labeler.yml` and can be configured in the workflow.
### `.github/PULL_REQUEST_TEMPLATE.md`
The pull request template which prefills new pull requests.
Further documentation:
- [Creating a pull request template for your repository](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/creating-a-pull-request-template-for-your-repository)
> [!IMPORTANT]
> The filename `.github/PULL_REQUEST_TEMPLATE.md` is predetermined by GitHub.
### `.github/SECURITY.md`
The goal is to describe how to securely report security vulnerabilities for this repository. The security policy is linked at <https://github.com/nlohmann/json/security/policy>.
Further documentation:
- [Adding a security policy to your repository](https://docs.github.com/en/code-security/getting-started/adding-a-security-policy-to-your-repository)
> [!IMPORTANT]
> The filename `.github/SECURITY.yml` is predetermined by GitHub.
> [!NOTE]
> The file is part of the documentation and is included in `docs/mkdocs/docs/community/security_policy.md`.
### `LICENSE.MIT`
The license of the project.
Further documentation:
- [Adding a license to a repository](https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/adding-a-license-to-a-repository)
> [!IMPORTANT]
> The filename `LICENSE.MIT` is partly predetermined by GitHub. The root filename must be `LICENSE`.
## REUSE
### `.reuse/dep5`
The file defines the licenses of certain third-party components in the repository. The root `Makefile` contains a target `reuse` that checks for compliance.
message(AUTHOR_WARNING"Failed to compile cmake/detect_libcpp_version to detect the used C++ standard library. This does not affect the library or the test cases. Please still create an issue at https://github.com/nlohmann/json to investigate this.\n${LIBCPP_VERSION_COMPILE_OUTPUT}")
endif()
set(LIBCPP_VERSION_OUTPUT_CACHED"${LIBCPP_VERSION_OUTPUT}"CACHESTRING"Detected C++ standard library version")
endif()
message(STATUS"C++ standard library: ${LIBCPP_VERSION_OUTPUT_CACHED}")
static bool accept(IteratorType first, IteratorType last,
const bool ignore_comments = false);
const bool ignore_comments = false,
const bool ignore_trailing_commas = false);
```
Checks whether the input is valid JSON.
@ -17,10 +19,10 @@ 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
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.
## Template parameters
@ -29,9 +31,9 @@ Unlike the [`parse`](parse.md) function, this function neither throws an excepti
: A compatible input, for instance:
- an `std::istream` object
- a `FILE` pointer (must not be null)
- a `#!c FILE` pointer (throws if null)
- a C-style array of characters
- a pointer to a null-terminated string of single byte characters
- a pointer to a null-terminated string of single byte characters (throws if null)
- a `std::string`
- an object `obj` for which `begin(obj)` and `end(obj)` produces a valid pair of iterators.
@ -50,11 +52,15 @@ Unlike the [`parse`](parse.md) function, this function neither throws an excepti
: whether comments should be ignored and treated like whitespace (`#!cpp true`) or yield a parse error
(`#!cpp false`); (optional, `#!cpp false` by default)
`ignore_trailing_commas` (in)
: whether trailing commas in arrays or objects should be ignored and treated like whitespace (`#!cpp true`) or yield a parse error
(`#!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
@ -64,18 +70,17 @@ Whether the input is valid JSON.
Strong guarantee: if an exception is thrown, there are no changes in the JSON value.
## Exceptions
Throws [`parse_error.101`](../../home/exceptions.md#jsonexceptionparse_error101) in case of an empty input like a null `#!c FILE*` or `#!c char*` pointer.
## Complexity
Linear in the length of the input. The parser is a predictive LL(1) parser.
## Notes
(1) A UTF-8 byte order mark is silently ignored.
!!! danger "Runtime assertion"
The precondition that a passed `#!cpp FILE` pointer must not be null is enforced with a
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.