This commit is contained in:
nlohmann committed 2026-10-19 23:27:40 +00:00
1 parent 98c9bea1d1
commit 53e1ee907f
24 files changed
+415 -342

No files matched your search

+3
View File
@@ -534,6 +534,9 @@ Note: Some modern features (like C++20 ranges or filesystem support) may be disa
headers are included.
- [x] On Windows, the library is compiled with `<Windows.h>` being included to detect and avoid common bugs (see
[`unit-windows_h.cpp`](https://github.com/nlohmann/json/blob/develop/tests/src/unit-windows_h.cpp)).
- [x] The library is compiled with Qt's keyword macros (`slots`, `signals`, `emit`, `foreach`, `forever`) being defined
to make sure it does not use them as identifiers (see
[`unit-qt_keywords.cpp`](https://github.com/nlohmann/json/blob/develop/tests/src/unit-qt_keywords.cpp)).
- [x] The library is compiled with exceptions disabled to support alternative means of error handling.
## Stable public API
+2 -2
View File
@@ -397,7 +397,7 @@
<span class=w> </span><span class=s>-Wzero-as-null-pointer-constant</span>
<span class=w> </span><span class=s>-Wzero-length-bounds</span>
<span class=p>)</span>
</code></pre></div> </details> </li> </ul> <h2 id=c-standard-library-compliance>C++ standard library compliance<a class=headerlink href=#c-standard-library-compliance title="Permanent link">&para;</a></h2> <div class="admonition success"> <p class=admonition-title>Requirement: No prerequisites</p> <p>The library has no prerequisites other than the Standard Template Library (<abbr title="Standard Template Library">STL</abbr>).</p> </div> <ul class=task-list> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> The library is compiled and tested with both <a href="https://libcxx.llvm.org">libc++</a> and <a href="https://gcc.gnu.org/onlinedocs/libstdc++/">libstdc++</a> to detect subtle differences or incompatibilities.</li> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> The code checked with <a href="https://include-what-you-use.org">Include What You Use (IWYU)</a> that all required standard headers are included.</li> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> On Windows, the library is compiled with <code>&lt;Windows.h&gt;</code> being included to detect and avoid common bugs (see <a href="https://github.com/nlohmann/json/blob/develop/tests/src/unit-windows_h.cpp"><code>unit-windows_h.cpp</code></a>).</li> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> The library is compiled with exceptions disabled to support alternative means of error handling.</li> </ul> <h2 id=stable-public-api>Stable public <abbr title="Application Programming Interface">API</abbr><a class=headerlink href=#stable-public-api title="Permanent link">&para;</a></h2> <div class="admonition success"> <p class=admonition-title>Requirement: Stable public <abbr title="Application Programming Interface">API</abbr></p> <p>Any change to the library does not break the public <abbr title="Application Programming Interface">API</abbr>.</p> </div> <ul class=task-list> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> All public <abbr title="Application Programming Interface">API</abbr> functions are tested with a variety of arguments.</li> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> The library is compiled and tested with different template arguments for number, string, array, and object types.</li> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> Unit tests cover all lines of the code base.</li> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> Every exception of the library is thrown in the test suite, and the error messages and exception ids are checked.</li> </ul> <div class="admonition success"> <p class=admonition-title>Requirement: Complete documentation</p> <p>The public <abbr title="Application Programming Interface">API</abbr> is extensively documented.</p> </div> <ul class=task-list> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> Every public <abbr title="Application Programming Interface">API</abbr> function has a dedicated page in the <a href="https://json.nlohmann.me/api/basic_json/"><abbr title="Application Programming Interface">API</abbr> reference documentation</a> with a self-contained code example.</li> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> All examples in the documentation are tested, and changes in their output are treated as an error.</li> </ul> <h2 id=robust-input-processing>Robust input processing<a class=headerlink href=#robust-input-processing title="Permanent link">&para;</a></h2> <div class="admonition success"> <p class=admonition-title>Requirement: Standards compliance</p> <p>The library is compliant to <abbr title="JavaScript Object Notation">JSON</abbr> as defined in <a href="https://datatracker.ietf.org/doc/html/rfc8259"><abbr title="Request for Comments">RFC</abbr> 8259</a>.</p> </div> <ul class=task-list> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> The lexer is tested with all valid Unicode code points and all prefixes of all invalid Unicode code points.</li> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></sLine truncated
</code></pre></div> </details> </li> </ul> <h2 id=c-standard-library-compliance>C++ standard library compliance<a class=headerlink href=#c-standard-library-compliance title="Permanent link">&para;</a></h2> <div class="admonition success"> <p class=admonition-title>Requirement: No prerequisites</p> <p>The library has no prerequisites other than the Standard Template Library (<abbr title="Standard Template Library">STL</abbr>).</p> </div> <ul class=task-list> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> The library is compiled and tested with both <a href="https://libcxx.llvm.org">libc++</a> and <a href="https://gcc.gnu.org/onlinedocs/libstdc++/">libstdc++</a> to detect subtle differences or incompatibilities.</li> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> The code checked with <a href="https://include-what-you-use.org">Include What You Use (IWYU)</a> that all required standard headers are included.</li> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> On Windows, the library is compiled with <code>&lt;Windows.h&gt;</code> being included to detect and avoid common bugs (see <a href="https://github.com/nlohmann/json/blob/develop/tests/src/unit-windows_h.cpp"><code>unit-windows_h.cpp</code></a>).</li> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> The library is compiled with Qt's keyword macros (<code>slots</code>, <code>signals</code>, <code>emit</code>, <code>foreach</code>, <code>forever</code>) being defined to make sure it does not use them as identifiers (see <a href="https://github.com/nlohmann/json/blob/develop/tests/src/unit-qt_keywords.cpp"><code>unit-qt_keywords.cpp</code></a>).</li> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> The library is compiled with exceptions disabled to support alternative means of error handling.</li> </ul> <h2 id=stable-public-api>Stable public <abbr title="Application Programming Interface">API</abbr><a class=headerlink href=#stable-public-api title="Permanent link">&para;</a></h2> <div class="admonition success"> <p class=admonition-title>Requirement: Stable public <abbr title="Application Programming Interface">API</abbr></p> <p>Any change to the library does not break the public <abbr title="Application Programming Interface">API</abbr>.</p> </div> <ul class=task-list> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> All public <abbr title="Application Programming Interface">API</abbr> functions are tested with a variety of arguments.</li> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> The library is compiled and tested with different template arguments for number, string, array, and object types.</li> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> Unit tests cover all lines of the code base.</li> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> Every exception of the library is thrown in the test suite, and the error messages and exception ids are checked.</li> </ul> <div class="admonition success"> <p class=admonition-title>Requirement: Complete documentation</p> <p>The public <abbr title="Application Programming Interface">API</abbr> is extensively documented.</p> </div> <ul class=task-list> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> Every public <abbr title="Application Programming Interface">API</abbr> function has a dedicated page in the <a href="https://json.nlohmann.me/api/basic_json/"><abbr title="Application Programming Interface">API</abbr> reference documentation</a> with a self-contained code example.</li> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> All examples in the documentation are tested, and changes in their output are treated as an error.</li> </ul> <h2 id=robust-input-processing>Robust input processing<a class=headerlink href=#robust-input-processing title="Permanent link">&para;</a></h2> <div class="admonition success"> <p class=admonition-title>Requirement: Standards compliance</p> <p>The library is compliant to <abbr title="JavaScript Object Notation">JSON</abbr> as defined in <a href="https://datatracker.ieLine truncated
<span class=c1># by every supported compiler, and tools/amalgamate/amalgamate.py strips it from</span>
<span class=c1># single_include, so there is nothing left to fix here.</span>
@@ -562,4 +562,4 @@
<span class=c1># for the linux (LF) line end style</span>
<span class=na>--lineend</span><span class=o>=</span><span class=s>linux</span>
</code></pre></div> </details> </li> <li class=task-list-item> <p><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> The code style is checked with <a href="https://github.com/cpplint/cpplint">cpplint</a> with 61 enabled rules.</p> </li> </ul> <h2 id=simple-integration>Simple integration<a class=headerlink href=#simple-integration title="Permanent link">&para;</a></h2> <div class="admonition success"> <p class=admonition-title>Requirement: Single header</p> <p>The library can be used by adding a single header to a C++ project.</p> </div> <ul class=task-list> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> An amalgamation script is used to check if the source code is exposed as a self-contained single-header file.</li> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> The test suite is checked against the amalgamated source file as well as the individual source file.</li> </ul> <div class="admonition success"> <p class=admonition-title>Requirement: CMake as primary development tool</p> <p>All library functions are exposed and usable by CMake.</p> </div> <ul class=task-list> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> All library options are exposed as <a href="https://json.nlohmann.me/integration/cmake/">CMake options</a> and tested.</li> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> The library is tested against relevant CMake versions:</li> <li>CMake 3.5 (the earliest supported)</li> <li>CMake 3.31.6 (the latest 3.x release)</li> <li>CMake 4.0.0 (a very recent release)</li> </ul> <!-- https://squidfunk.github.io/mkdocs-material/reference/tooltips/#adding-a-glossary --> <aside class=md-source-file> <span class=md-source-file__fact> <span class=md-icon title="Last update"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M21 13.1c-.1 0-.3.1-.4.2l-1 1 2.1 2.1 1-1c.2-.2.2-.6 0-.8l-1.3-1.3c-.1-.1-.2-.2-.4-.2m-1.9 1.8-6.1 6V23h2.1l6.1-6.1zM12.5 7v5.2l4 2.4-1 1L11 13V7zM11 21.9c-5.1-.5-9-4.8-9-9.9C2 6.5 6.5 2 12 2c5.3 0 9.6 4.1 10 9.3-.3-.1-.6-.2-1-.2s-.7.1-1 .2C19.6 7.2 16.2 4 12 4c-4.4 0-8 3.6-8 8 0 4.1 3.1 7.5 7.1 7.9l-.1.2z"/></svg> </span> <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date" title="October 11, 2026 06:21:51 UTC">October 11, 2026</span> </span> </aside> </article> </div> <script>var tabs=__md_get("__tabs");if(Array.isArray(tabs))e:for(var set of document.querySelectorAll(".tabbed-set")){var labels=set.querySelector(".tabbed-labels");for(var tab of tabs)for(var label of labels.getElementsByTagName("label"))if(label.innerText.trim()===tab){var input=document.getElementById(label.htmlFor);input.checked=!0;continue e}}</script> <script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script> </div> <button type=button class="md-top md-icon" data-md-component=top hidden> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8z"/></svg> Back to top </button> </main> <footer class=md-footer> <div class="md-footer-meta md-typeset"> <div class="md-footer-meta__inner md-grid"> <div class=md-copyright> <div class=md-copyright__highlight> Copyright &copy; 2013-2026 Niels Lohmann </div> </div> <div class=md-social> <a href="https://github.com/nlohmann" target="_blank" rel="noopener" title="github.com" class="md-social__link"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 512 512"><!-- Font Awesome Free 7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2025 Fonticons, Inc.--><path d="M173.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6m-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3m44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9M252.8 8C114.1 8 8 113.3 8 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C436.2 457.8 50Line truncated
</code></pre></div> </details> </li> <li class=task-list-item> <p><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> The code style is checked with <a href="https://github.com/cpplint/cpplint">cpplint</a> with 61 enabled rules.</p> </li> </ul> <h2 id=simple-integration>Simple integration<a class=headerlink href=#simple-integration title="Permanent link">&para;</a></h2> <div class="admonition success"> <p class=admonition-title>Requirement: Single header</p> <p>The library can be used by adding a single header to a C++ project.</p> </div> <ul class=task-list> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> An amalgamation script is used to check if the source code is exposed as a self-contained single-header file.</li> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> The test suite is checked against the amalgamated source file as well as the individual source file.</li> </ul> <div class="admonition success"> <p class=admonition-title>Requirement: CMake as primary development tool</p> <p>All library functions are exposed and usable by CMake.</p> </div> <ul class=task-list> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> All library options are exposed as <a href="https://json.nlohmann.me/integration/cmake/">CMake options</a> and tested.</li> <li class=task-list-item><label class=task-list-control><input type=checkbox disabled checked><span class=task-list-indicator></span></label> The library is tested against relevant CMake versions:</li> <li>CMake 3.5 (the earliest supported)</li> <li>CMake 3.31.6 (the latest 3.x release)</li> <li>CMake 4.0.0 (a very recent release)</li> </ul> <!-- https://squidfunk.github.io/mkdocs-material/reference/tooltips/#adding-a-glossary --> <aside class=md-source-file> <span class=md-source-file__fact> <span class=md-icon title="Last update"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M21 13.1c-.1 0-.3.1-.4.2l-1 1 2.1 2.1 1-1c.2-.2.2-.6 0-.8l-1.3-1.3c-.1-.1-.2-.2-.4-.2m-1.9 1.8-6.1 6V23h2.1l6.1-6.1zM12.5 7v5.2l4 2.4-1 1L11 13V7zM11 21.9c-5.1-.5-9-4.8-9-9.9C2 6.5 6.5 2 12 2c5.3 0 9.6 4.1 10 9.3-.3-.1-.6-.2-1-.2s-.7.1-1 .2C19.6 7.2 16.2 4 12 4c-4.4 0-8 3.6-8 8 0 4.1 3.1 7.5 7.1 7.9l-.1.2z"/></svg> </span> <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date" title="October 19, 2026 20:00:31 UTC">October 19, 2026</span> </span> </aside> </article> </div> <script>var tabs=__md_get("__tabs");if(Array.isArray(tabs))e:for(var set of document.querySelectorAll(".tabbed-set")){var labels=set.querySelector(".tabbed-labels");for(var tab of tabs)for(var label of labels.getElementsByTagName("label"))if(label.innerText.trim()===tab){var input=document.getElementById(label.htmlFor);input.checked=!0;continue e}}</script> <script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script> </div> <button type=button class="md-top md-icon" data-md-component=top hidden> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8z"/></svg> Back to top </button> </main> <footer class=md-footer> <div class="md-footer-meta md-typeset"> <div class="md-footer-meta__inner md-grid"> <div class=md-copyright> <div class=md-copyright__highlight> Copyright &copy; 2013-2026 Niels Lohmann </div> </div> <div class=md-social> <a href="https://github.com/nlohmann" target="_blank" rel="noopener" title="github.com" class="md-social__link"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 512 512"><!-- Font Awesome Free 7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2025 Fonticons, Inc.--><path d="M173.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6m-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3m44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9M252.8 8C114.1 8 8 113.3 8 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C436.2 457.8 50Line truncated
+1
View File
@@ -527,6 +527,7 @@ The library has no prerequisites other than the Standard Template Library (STL).
- The library is compiled and tested with both [libc++](https://libcxx.llvm.org) and [libstdc++](https://gcc.gnu.org/onlinedocs/libstdc++/) to detect subtle differences or incompatibilities.
- The code checked with [Include What You Use (IWYU)](https://include-what-you-use.org) that all required standard headers are included.
- On Windows, the library is compiled with `<Windows.h>` being included to detect and avoid common bugs (see [`unit-windows_h.cpp`](https://github.com/nlohmann/json/blob/develop/tests/src/unit-windows_h.cpp)).
- The library is compiled with Qt's keyword macros (`slots`, `signals`, `emit`, `foreach`, `forever`) being defined to make sure it does not use them as identifiers (see [`unit-qt_keywords.cpp`](https://github.com/nlohmann/json/blob/develop/tests/src/unit-qt_keywords.cpp)).
- The library is compiled with exceptions disabled to support alternative means of error handling.
## Stable public API