This commit is contained in:
nlohmann committed 2026-10-09 06:04:53 +00:00
1 parent ad947e10d0
commit 1eb9589abb
6 files changed
+318 -294

No files matched your search

+23 -9
View File
@@ -36,13 +36,26 @@ work items are tracked in the [GitHub milestones](https://github.com/nlohmann/js
## API stability
Releases follow [semantic versioning](https://semver.org): a minor or patch release of version 3.x does not break code
that uses the public API. In particular, a 3.x release does not:
that uses the public API, unless that code opts in to a change with a macro as described [below](#version-40). In
particular, a 3.x release does not:
- change the signature of a function (its parameter types, return type, number of parameters, or the const-ness of a
member function);
- remove or rename a function or class;
- make breaking changes to the signature of a function: the types or order of its existing parameters, its return type,
its `noexcept` or `constexpr` specifier, or the const-ness of a member function. New parameters may be added if they
have a default value;
- remove or rename a function or class, or change the template parameters of a public class template;
- change which exceptions a function throws, or the [exception ids](../home/exceptions.md);
- change access specifiers or default arguments.
- change access specifiers, or change or remove existing default arguments. New default arguments may be added;
- change the JSON type that a valid input parses to, or the text that `dump()` produces for a valid value;
- accept input that was rejected before, or reject input that was accepted before;
- change the order in which the keys of an object are iterated. The default type sorts keys, and
[`ordered_json`](../api/ordered_json.md) keeps insertion order;
- change when iterators, pointers, or references are invalidated, or the state of a moved-from `basic_json`;
- add or remove implicit conversions from `basic_json`;
- change how `to_json` and `from_json` functions are found, or the behavior of
[`adl_serializer`](../api/adl_serializer/index.md);
- add pure virtual functions to the [`json_sax`](../api/json_sax/index.md) interface;
- remove, rename, renumber, or add enumerators of `value_t`;
- remove or rename a documented macro, CMake option, CMake target, or header, or change what a documented macro does.
Exceptions to these rules, for instance when fixing a bug requires changing the exception a function throws, are
documented in the [release notes](../home/releases.md).
@@ -51,13 +64,14 @@ The following are **not** part of the public API and may change in any release,
- The text of exception messages returned by `what()`. Use the [exception id](../home/exceptions.md) to tell errors
apart.
- The ABI, including `sizeof(basic_json)` and the memory layout of its values. Recompile your code when you upgrade the
library. The [versioned inline namespace](../features/namespace.md) turns mixing versions into a link error.
- The ABI, including `sizeof(basic_json)` and the memory layout of its values. The
[versioned inline namespace](../features/namespace.md) turns mixing versions into a link error.
- The hash values returned by `std::hash` for `basic_json`. Numbers that compare equal still hash equally.
- Everything in namespace `nlohmann::detail`, and macros and type traits that are not documented in the
[API reference](../api/basic_json/index.md).
Changes that would break the public API are only added behind a macro whose default keeps the 3.x behavior, see
[Version 4.0](#version-40).
Breaking changes are only added behind a macro whose default keeps the 3.x behavior. See [Version 4.0](#version-40) and
the [macro overview](../features/macros.md).
## Version 4.0
+2 -2
View File
@@ -1,4 +1,4 @@
<!doctype html><html lang=en class=no-js> <head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=author content="Niels Lohmann"><link href="https://json.nlohmann.me/community/roadmap/" rel="canonical"><link href=../governance/ rel=prev><link href=../security_policy/ rel=next><link rel=icon href=../../assets/images/favicon.png><meta name=generator content="mkdocs-1.6.1, mkdocs-material-9.7.7"><title>Roadmap - JSON for Modern C++</title><link rel=stylesheet href=../../assets/stylesheets/main.ec1eaa64.min.css><link rel=stylesheet href=../../assets/stylesheets/palette.ab4e12ef.min.css><link rel="stylesheet" href="../../assets/external/fonts.googleapis.com/css.61a430c9.css"><style>:root{--md-text-font:"Roboto";--md-code-font:"JetBrains Mono"}</style><link rel=stylesheet href=../../css/custom.css><script>__md_scope=new URL("../..",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script></head> <body dir=ltr data-md-color-scheme=default data-md-color-primary=indigo data-md-color-accent=indigo> <input class=md-toggle data-md-toggle=drawer type=checkbox id=__drawer autocomplete=off> <input class=md-toggle data-md-toggle=search type=checkbox id=__search autocomplete=off> <label class=md-overlay for=__drawer></label> <div data-md-component=skip> <a href=#roadmap class=md-skip> Skip to content </a> </div> <div data-md-component=announce> </div> <header class=md-header data-md-component=header> <nav class="md-header__inner md-grid" aria-label=Header> <a href=../.. title="JSON for Modern C++" class="md-header__button md-logo" aria-label="JSON for Modern C++" data-md-component=logo> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg> </a> <label class="md-header__button md-icon" for=__drawer> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"/></svg> </label> <div class=md-header__title data-md-component=header-title> <div class=md-header__ellipsis> <div class=md-header__topic> <span class=md-ellipsis> JSON for Modern C++ </span> </div> <div class=md-header__topic data-md-component=header-topic> <span class=md-ellipsis> Roadmap </span> </div> </div> </div> <form class=md-header__option data-md-component=palette> <input class=md-option data-md-color-media="(prefers-color-scheme: light)" data-md-color-scheme=default data-md-color-primary=indigo data-md-color-accent=indigo aria-label="Switch to dark mode" type=radio name=__palette id=__palette_0> <label class="md-header__button md-icon" title="Switch to dark mode" for=__palette_1 hidden> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M12 8a4 4 0 0 0-4 4 4 4 0 0 0 4 4 4 4 0 0 0 4-4 4 4 0 0 0-4-4m0 10a6 6 0 0 1-6-6 6 6 0 0 1 6-6 6 6 0 0 1 6 6 6 6 0 0 1-6 6m8-9.31V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12z"/></svg> </label> <input class=md-option data-md-color-media="(prefers-color-scheme: dark)" data-md-color-scheme=slate data-md-color-primary=indigo data-md-color-accent=indigo aria-label="Switch to light mode" type=radio name=__palette id=__palette_1> <label class="md-header__button md-icon" title="Switch to light mode" for=__palette_0 hidden> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M12 18c-.89 0-1.74-.2-2.5-.55C11.56 16.5 13 14.42 13 12s-1.44-4.5-3.5-5.45C10.26 6.2 11.11 6 12 6a6 6 0 0 1 6 6 6 6 0 0 1-6 6m8-9.31V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12z"/></svg> </label> </form> <script>var palette=__md_get("__palette");if(palette&&palette.color){if("(prefers-color-scheme)"===palette.color.media){var media=matchMedia("(prefers-color-scheme: light)"),input=document.querySelector(media.matches?"[data-md-color-media='(prefers-color-scheme: light)']":"[data-md-color-media='(prefers-color-scheme: dark)']");palette.color.media=input.getAttribute("data-md-color-media"),palette.color.scheme=input.getAttribute("data-md-color-scheme"),palette.color.primary=input.getAttribute("data-md-color-primary"),palette.color.accent=input.getAttribute("data-md-color-accent")}for(var[key,value]of Object.entries(palette.color))document.body.setAttribute("data-md-color-"+key,value)}</script> <label class="md-header__button md-icon" for=__search> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg> </label> <div class=md-search data-mdLine truncated
<!doctype html><html lang=en class=no-js> <head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=author content="Niels Lohmann"><link href="https://json.nlohmann.me/community/roadmap/" rel="canonical"><link href=../governance/ rel=prev><link href=../security_policy/ rel=next><link rel=icon href=../../assets/images/favicon.png><meta name=generator content="mkdocs-1.6.1, mkdocs-material-9.7.7"><title>Roadmap - JSON for Modern C++</title><link rel=stylesheet href=../../assets/stylesheets/main.ec1eaa64.min.css><link rel=stylesheet href=../../assets/stylesheets/palette.ab4e12ef.min.css><link rel="stylesheet" href="../../assets/external/fonts.googleapis.com/css.61a430c9.css"><style>:root{--md-text-font:"Roboto";--md-code-font:"JetBrains Mono"}</style><link rel=stylesheet href=../../css/custom.css><script>__md_scope=new URL("../..",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script></head> <body dir=ltr data-md-color-scheme=default data-md-color-primary=indigo data-md-color-accent=indigo> <input class=md-toggle data-md-toggle=drawer type=checkbox id=__drawer autocomplete=off> <input class=md-toggle data-md-toggle=search type=checkbox id=__search autocomplete=off> <label class=md-overlay for=__drawer></label> <div data-md-component=skip> <a href=#roadmap class=md-skip> Skip to content </a> </div> <div data-md-component=announce> </div> <header class=md-header data-md-component=header> <nav class="md-header__inner md-grid" aria-label=Header> <a href=../.. title="JSON for Modern C++" class="md-header__button md-logo" aria-label="JSON for Modern C++" data-md-component=logo> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg> </a> <label class="md-header__button md-icon" for=__drawer> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"/></svg> </label> <div class=md-header__title data-md-component=header-title> <div class=md-header__ellipsis> <div class=md-header__topic> <span class=md-ellipsis> JSON for Modern C++ </span> </div> <div class=md-header__topic data-md-component=header-topic> <span class=md-ellipsis> Roadmap </span> </div> </div> </div> <form class=md-header__option data-md-component=palette> <input class=md-option data-md-color-media="(prefers-color-scheme: light)" data-md-color-scheme=default data-md-color-primary=indigo data-md-color-accent=indigo aria-label="Switch to dark mode" type=radio name=__palette id=__palette_0> <label class="md-header__button md-icon" title="Switch to dark mode" for=__palette_1 hidden> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M12 8a4 4 0 0 0-4 4 4 4 0 0 0 4 4 4 4 0 0 0 4-4 4 4 0 0 0-4-4m0 10a6 6 0 0 1-6-6 6 6 0 0 1 6-6 6 6 0 0 1 6 6 6 6 0 0 1-6 6m8-9.31V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12z"/></svg> </label> <input class=md-option data-md-color-media="(prefers-color-scheme: dark)" data-md-color-scheme=slate data-md-color-primary=indigo data-md-color-accent=indigo aria-label="Switch to light mode" type=radio name=__palette id=__palette_1> <label class="md-header__button md-icon" title="Switch to light mode" for=__palette_0 hidden> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M12 18c-.89 0-1.74-.2-2.5-.55C11.56 16.5 13 14.42 13 12s-1.44-4.5-3.5-5.45C10.26 6.2 11.11 6 12 6a6 6 0 0 1 6 6 6 6 0 0 1-6 6m8-9.31V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12z"/></svg> </label> </form> <script>var palette=__md_get("__palette");if(palette&&palette.color){if("(prefers-color-scheme)"===palette.color.media){var media=matchMedia("(prefers-color-scheme: light)"),input=document.querySelector(media.matches?"[data-md-color-media='(prefers-color-scheme: light)']":"[data-md-color-media='(prefers-color-scheme: dark)']");palette.color.media=input.getAttribute("data-md-color-media"),palette.color.scheme=input.getAttribute("data-md-color-scheme"),palette.color.primary=input.getAttribute("data-md-color-primary"),palette.color.accent=input.getAttribute("data-md-color-accent")}for(var[key,value]of Object.entries(palette.color))document.body.setAttribute("data-md-color-"+key,value)}</script> <label class="md-header__button md-icon" for=__search> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg> </label> <div class=md-search data-mdLine truncated
<span class=cp>#define JSON_USE_GLOBAL_UDLS 0</span>
<span class=cp>#define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON 0</span>
<span class=cp>#define JSON_BRACE_INIT_COPY_SEMANTICS 1</span>
@@ -8,4 +8,4 @@
<span class=cp>#define JSON_DISABLE_TUPLE_REFERENCE_CONVERSION 1</span>
<span class=cp>#define JSON_DELETE_DEPRECATED_FUNCTIONS 1</span>
<span class=cp>#include</span><span class=w> </span><span class=cpf>&lt;nlohmann/json.hpp&gt;</span>
</code></pre></div> <p>The macros must be defined before the library header is included; setting them once in the build system is the easiest way to achieve this.</p> <h3 id=removal-of-deprecated-functions>Removal of deprecated functions<a class=headerlink href=#removal-of-deprecated-functions title="Permanent link">&para;</a></h3> <p>Version 4.0 will remove all deprecated functions. Compiling with deprecation warnings enabled shows which of them your code still uses. Defining <a href=../../api/macros/json_delete_deprecated_functions/ ><code>JSON_DELETE_DEPRECATED_FUNCTIONS</code></a> to <code>1</code> turns these warnings into errors, as the deprecated functions are then deleted. The <a href=../../integration/migration_guide/#replace-deprecated-functions>migration guide</a> shows how to replace each of them.</p> <p>The <code>from_*</code> overloads taking a pointer and a length are not removed in version 4.0, but stay deleted. Without them, a call like <code>from_cbor(ptr, len)</code> would still compile: it would read <code>ptr</code> as a NUL-terminated string and convert <code>len</code> to the <code>strict</code> parameter.</p> <table> <thead> <tr> <th>Deprecated</th> <th>Since</th> <th>Migration</th> </tr> </thead> <tbody> <tr> <td><code class=highlight><span class=k>operator</span><span class=o>&lt;&lt;</span><span class=p>(</span><span class=n>basic_json</span><span class=o>&amp;</span><span class=p>,</span><span class=w> </span><span class=n>std</span><span class=o>::</span><span class=n>istream</span><span class=o>&amp;</span><span class=p>)</span></code></td> <td>3.0.0</td> <td><a href=../../integration/migration_guide/#parsing>Parsing</a></td> </tr> <tr> <td><code class=highlight><span class=k>operator</span><span class=o>&gt;&gt;</span><span class=p>(</span><span class=k>const</span><span class=w> </span><span class=n>basic_json</span><span class=o>&amp;</span><span class=p>,</span><span class=w> </span><span class=n>std</span><span class=o>::</span><span class=n>ostream</span><span class=o>&amp;</span><span class=p>)</span></code></td> <td>3.0.0</td> <td><a href=../../integration/migration_guide/#miscellaneous-functions>Miscellaneous functions</a></td> </tr> <tr> <td><code>iterator_wrapper</code></td> <td>3.1.0</td> <td><a href=../../integration/migration_guide/#miscellaneous-functions>Miscellaneous functions</a></td> </tr> <tr> <td><a href=../../api/basic_json/parse/ ><code>parse</code></a>, <a href=../../api/basic_json/accept/ ><code>accept</code></a>, and <a href=../../api/basic_json/sax_parse/ ><code>sax_parse</code></a> with an initializer list <code>{ptr, len}</code> or <code>{first, last}</code></td> <td>3.8.0</td> <td><a href=../../integration/migration_guide/#parsing>Parsing</a></td> </tr> <tr> <td><a href=../../api/basic_json/from_bson/ ><code>from_bson</code></a>, <a href=../../api/basic_json/from_cbor/ ><code>from_cbor</code></a>, <a href=../../api/basic_json/from_msgpack/ ><code>from_msgpack</code></a>, and <a href=../../api/basic_json/from_ubjson/ ><code>from_ubjson</code></a> with <code>(ptr, len)</code> or an initializer list</td> <td>3.8.0</td> <td><a href=../../integration/migration_guide/#parsing>Parsing</a></td> </tr> <tr> <td><a href=../../api/json_pointer/operator_string_t/ ><code>json_pointer::operator string_t</code></a></td> <td>3.11.0</td> <td><a href=../../integration/migration_guide/#json-pointers><abbr title="JavaScript Object Notation">JSON</abbr> Pointers</a></td> </tr> <tr> <td><a href=../../api/json_pointer/ ><code>json_pointer</code></a> with a <code>basic_json</code> type as template argument, and the overloads of <code>value</code>, <code>contains</code>, <code>operator[]</code>, and <code>at</code> accepting such a pointer</td> <td>3.11.0</td> <td><a href=../../integration/migration_guide/#json-pointers><abbr title="JavaScript Object Notation">JSON</abbr> Pointers</a></td> </tr> <tr> <td>Comparing a <a href=../../api/json_pointer/ ><code>json_pointer</code></a> with a string via <a href=../../api/json_pointer/operator_eq/ ><code>operator==</code></a> or <a href=../../api/json_pointer/operator_ne/ ><code>operator!=</code></a></td> <td>3.11.2</td> <td><a href=../../integration/migration_guide/#json-pointers><abbr title="JavaScript Object Notation">JSON</abbr> Pointers</a></td> </tr> <tr> <td><a href=../../api/basic_json/from_bjdata/ ><code>from_bjdata</code></a> and <a href=../../api/basic_json/from_bon8/ ><code>from_bon8</code></a> with <code>(ptr, len)</code></td> <td>3.13.0</td> <td><a href=../../integration/migration_guide/#parsing>Parsing</a></td> </tr> </tbody> </table> <p>The deprecated legacy comparison of discarded values is controlled by a macro and therefore listed in the table above.</p> <p>New breaking changes will follow the same path: they are added to these tables when they land in a 3.x release.</p> <!-- https://squidfunk.github.io/mkdocs-material/reference/tooltips/#adding-a-glossary --> <aside class=md-source-file> <span class=md-source-fiLine truncated
</code></pre></div> <p>The macros must be defined before the library header is included; setting them once in the build system is the easiest way to achieve this.</p> <h3 id=removal-of-deprecated-functions>Removal of deprecated functions<a class=headerlink href=#removal-of-deprecated-functions title="Permanent link">&para;</a></h3> <p>Version 4.0 will remove all deprecated functions. Compiling with deprecation warnings enabled shows which of them your code still uses. Defining <a href=../../api/macros/json_delete_deprecated_functions/ ><code>JSON_DELETE_DEPRECATED_FUNCTIONS</code></a> to <code>1</code> turns these warnings into errors, as the deprecated functions are then deleted. The <a href=../../integration/migration_guide/#replace-deprecated-functions>migration guide</a> shows how to replace each of them.</p> <p>The <code>from_*</code> overloads taking a pointer and a length are not removed in version 4.0, but stay deleted. Without them, a call like <code>from_cbor(ptr, len)</code> would still compile: it would read <code>ptr</code> as a NUL-terminated string and convert <code>len</code> to the <code>strict</code> parameter.</p> <table> <thead> <tr> <th>Deprecated</th> <th>Since</th> <th>Migration</th> </tr> </thead> <tbody> <tr> <td><code class=highlight><span class=k>operator</span><span class=o>&lt;&lt;</span><span class=p>(</span><span class=n>basic_json</span><span class=o>&amp;</span><span class=p>,</span><span class=w> </span><span class=n>std</span><span class=o>::</span><span class=n>istream</span><span class=o>&amp;</span><span class=p>)</span></code></td> <td>3.0.0</td> <td><a href=../../integration/migration_guide/#parsing>Parsing</a></td> </tr> <tr> <td><code class=highlight><span class=k>operator</span><span class=o>&gt;&gt;</span><span class=p>(</span><span class=k>const</span><span class=w> </span><span class=n>basic_json</span><span class=o>&amp;</span><span class=p>,</span><span class=w> </span><span class=n>std</span><span class=o>::</span><span class=n>ostream</span><span class=o>&amp;</span><span class=p>)</span></code></td> <td>3.0.0</td> <td><a href=../../integration/migration_guide/#miscellaneous-functions>Miscellaneous functions</a></td> </tr> <tr> <td><code>iterator_wrapper</code></td> <td>3.1.0</td> <td><a href=../../integration/migration_guide/#miscellaneous-functions>Miscellaneous functions</a></td> </tr> <tr> <td><a href=../../api/basic_json/parse/ ><code>parse</code></a>, <a href=../../api/basic_json/accept/ ><code>accept</code></a>, and <a href=../../api/basic_json/sax_parse/ ><code>sax_parse</code></a> with an initializer list <code>{ptr, len}</code> or <code>{first, last}</code></td> <td>3.8.0</td> <td><a href=../../integration/migration_guide/#parsing>Parsing</a></td> </tr> <tr> <td><a href=../../api/basic_json/from_bson/ ><code>from_bson</code></a>, <a href=../../api/basic_json/from_cbor/ ><code>from_cbor</code></a>, <a href=../../api/basic_json/from_msgpack/ ><code>from_msgpack</code></a>, and <a href=../../api/basic_json/from_ubjson/ ><code>from_ubjson</code></a> with <code>(ptr, len)</code> or an initializer list</td> <td>3.8.0</td> <td><a href=../../integration/migration_guide/#parsing>Parsing</a></td> </tr> <tr> <td><a href=../../api/json_pointer/operator_string_t/ ><code>json_pointer::operator string_t</code></a></td> <td>3.11.0</td> <td><a href=../../integration/migration_guide/#json-pointers><abbr title="JavaScript Object Notation">JSON</abbr> Pointers</a></td> </tr> <tr> <td><a href=../../api/json_pointer/ ><code>json_pointer</code></a> with a <code>basic_json</code> type as template argument, and the overloads of <code>value</code>, <code>contains</code>, <code>operator[]</code>, and <code>at</code> accepting such a pointer</td> <td>3.11.0</td> <td><a href=../../integration/migration_guide/#json-pointers><abbr title="JavaScript Object Notation">JSON</abbr> Pointers</a></td> </tr> <tr> <td>Comparing a <a href=../../api/json_pointer/ ><code>json_pointer</code></a> with a string via <a href=../../api/json_pointer/operator_eq/ ><code>operator==</code></a> or <a href=../../api/json_pointer/operator_ne/ ><code>operator!=</code></a></td> <td>3.11.2</td> <td><a href=../../integration/migration_guide/#json-pointers><abbr title="JavaScript Object Notation">JSON</abbr> Pointers</a></td> </tr> <tr> <td><a href=../../api/basic_json/from_bjdata/ ><code>from_bjdata</code></a> and <a href=../../api/basic_json/from_bon8/ ><code>from_bon8</code></a> with <code>(ptr, len)</code></td> <td>3.13.0</td> <td><a href=../../integration/migration_guide/#parsing>Parsing</a></td> </tr> </tbody> </table> <p>The deprecated legacy comparison of discarded values is controlled by a macro and therefore listed in the table above.</p> <p>New breaking changes will follow the same path: they are added to these tables when they land in a 3.x release.</p> <!-- https://squidfunk.github.io/mkdocs-material/reference/tooltips/#adding-a-glossary --> <aside class=md-source-file> <span class=md-source-fiLine truncated
+16 -6
View File
@@ -22,22 +22,32 @@ This page describes what the project intends to do, and what it does not intend
## API stability
Releases follow [semantic versioning](https://semver.org): a minor or patch release of version 3.x does not break code that uses the public API. In particular, a 3.x release does not:
Releases follow [semantic versioning](https://semver.org): a minor or patch release of version 3.x does not break code that uses the public API, unless that code opts in to a change with a macro as described [below](#version-40). In particular, a 3.x release does not:
- change the signature of a function (its parameter types, return type, number of parameters, or the const-ness of a member function);
- remove or rename a function or class;
- make breaking changes to the signature of a function: the types or order of its existing parameters, its return type, its `noexcept` or `constexpr` specifier, or the const-ness of a member function. New parameters may be added if they have a default value;
- remove or rename a function or class, or change the template parameters of a public class template;
- change which exceptions a function throws, or the [exception ids](https://json.nlohmann.me/home/exceptions/index.md);
- change access specifiers or default arguments.
- change access specifiers, or change or remove existing default arguments. New default arguments may be added;
- change the JSON type that a valid input parses to, or the text that `dump()` produces for a valid value;
- accept input that was rejected before, or reject input that was accepted before;
- change the order in which the keys of an object are iterated. The default type sorts keys, and [`ordered_json`](https://json.nlohmann.me/api/ordered_json/index.md) keeps insertion order;
- change when iterators, pointers, or references are invalidated, or the state of a moved-from `basic_json`;
- add or remove implicit conversions from `basic_json`;
- change how `to_json` and `from_json` functions are found, or the behavior of [`adl_serializer`](https://json.nlohmann.me/api/adl_serializer/index.md);
- add pure virtual functions to the [`json_sax`](https://json.nlohmann.me/api/json_sax/index.md) interface;
- remove, rename, renumber, or add enumerators of `value_t`;
- remove or rename a documented macro, CMake option, CMake target, or header, or change what a documented macro does.
Exceptions to these rules, for instance when fixing a bug requires changing the exception a function throws, are documented in the [release notes](https://json.nlohmann.me/home/releases/index.md).
The following are **not** part of the public API and may change in any release, including patch releases:
- The text of exception messages returned by `what()`. Use the [exception id](https://json.nlohmann.me/home/exceptions/index.md) to tell errors apart.
- The ABI, including `sizeof(basic_json)` and the memory layout of its values. Recompile your code when you upgrade the library. The [versioned inline namespace](https://json.nlohmann.me/features/namespace/index.md) turns mixing versions into a link error.
- The ABI, including `sizeof(basic_json)` and the memory layout of its values. The [versioned inline namespace](https://json.nlohmann.me/features/namespace/index.md) turns mixing versions into a link error.
- The hash values returned by `std::hash` for `basic_json`. Numbers that compare equal still hash equally.
- Everything in namespace `nlohmann::detail`, and macros and type traits that are not documented in the [API reference](https://json.nlohmann.me/api/basic_json/index.md).
Changes that would break the public API are only added behind a macro whose default keeps the 3.x behavior, see [Version 4.0](#version-40).
Breaking changes are only added behind a macro whose default keeps the 3.x behavior. See [Version 4.0](#version-40) and the [macro overview](https://json.nlohmann.me/features/macros/index.md).
## Version 4.0
+1 -1
View File
@@ -1 +1 @@
{"config":{"lang":["en"],"separator":"[\\s\\-\\.]","pipeline":["stopWordFilter"],"fields":{"title":{"boost":1000.0},"text":{"boost":1.0},"tags":{"boost":1000000.0}}},"docs":[{"location":"","title":"JSON for Modern C++","text":"<p>JSON for Modern C++ is a header-only C++11 library that turns JSON into a first-class C++ data type, using the operator magic of modern C++ so that creating, reading, and modifying JSON values feels as natural as it does in languages like Python. The whole library is available as a single header, <code>json.hpp</code>, with no dependencies, no subproject, and no complex build system to set up; a companion header, <code>json_fwd.hpp</code>, provides forward declarations to keep compile times down. See header-only integration for details. It is heavily unit-tested with 100% code coverage, checked with Valgrind and the Clang Sanitizers for memory leaks, and continuously fuzz-tested by Google OSS-Fuzz.</p>"},{"location":"#quick-start","title":"Quick start","text":"<p>Add the single header to your project and use the library like this:</p> <pre><code>#include &lt;iostream&gt;\n#include &lt;nlohmann/json.hpp&gt;\n\nusing json = nlohmann::json;\n\nint main()\n{\n // parse a JSON string\n json j = json::parse(R\"({\"happy\": true, \"pi\": 3.141})\");\n\n // access and modify values\n j[\"name\"] = \"Niels\";\n j[\"list\"] = {1, 0, 2};\n\n // serialize with an indent of 4 spaces\n std::cout &lt;&lt; j.dump(4) &lt;&lt; '\\n';\n}\n</code></pre> <p>Get the library by copying the single header <code>json.hpp</code> from the releases page into a directory <code>nlohmann</code> on your include path, or by installing it with a package manager:</p> <pre><code>brew install nlohmann-json # Homebrew\nvcpkg install nlohmann-json # vcpkg\n</code></pre> <pre><code>find_package(nlohmann_json 3.12.0 REQUIRED)\ntarget_link_libraries(myproject PRIVATE nlohmann_json::nlohmann_json)\n</code></pre> <p>See Integration for CMake in detail, all supported package managers (Conan, Meson, Bazel, Conda, and more), and pkg-config.</p>"},{"location":"#explore-the-documentation","title":"Explore the documentation","text":"<ul> <li> <p> Features</p> <p>Creating, parsing, accessing, and serializing JSON values, JSON Pointer/Patch, binary formats, and more.</p> <p> Features</p> </li> <li> <p> Integration</p> <p>Add the library to your project via a single header, CMake, a package manager, or pkg-config.</p> <p> Integration</p> </li> <li> <p> API documentation</p> <p>The complete reference for <code>basic_json</code> and its member functions, types, and related classes.</p> <p> API documentation</p> </li> <li> <p> FAQ</p> <p>Answers to common questions and known surprises when using the library.</p> <p> FAQ</p> </li> <li> <p> Releases</p> <p>What changed in each release, with links to the relevant documentation.</p> <p> Releases</p> </li> <li> <p> Community</p> <p>The ecosystem, contribution guidelines, governance, and quality assurance around the project.</p> <p> Community</p> </li> </ul> <p>Unreleased changes</p> <p>This documentation is built from the <code>develop</code> branch and may describe changes that are not part of a release yet. Their version numbers are followed by an unreleased badge; see Releases for what shipped in each version.</p> <p>The library is licensed under the MIT License. The source code, issue tracker, and discussions are on GitHub.</p>"},{"location":"api/json/","title":"nlohmann::json","text":"<pre><code>using json = basic_json&lt;&gt;;\n</code></pre> <p>This type is the default specialization of the basic_json class which uses the standard template types.</p>"},{"location":"api/json/#examples","title":"Examples","text":"Example <p>The example below demonstrates how to use the type <code>nlohmann::json</code>.</p> <pre><code>#include &lt;iostream&gt;\n#include &lt;iomanip&gt;\n#include &lt;nlohmann/json.hpp&gt;\n\nusing json = nlohmann::json;\n\nint main()\n{\n // create a JSON object\n json j =\n {\n {\"pi\", 3.141},\n {\"happy\", true},\n {\"name\", \"Niels\"},\n {\"nothing\", nullptr},\n {\n \"answer\", {\n {\"everything\", 42}\n }\n },\n {\"list\", {1, 0, 2}},\n {\n \"object\", {\n {\"currency\", \"USD\"},\n {\"value\", 42.99}\n }\n }\n };\n\n // add new values\n j[\"new\"][\"key\"][\"value\"] = {\"another\", \"list\"};\n\n // count elements\n auto s = j.size();\n j[\"size\"] = s;\n\n // pretty print with indent of 4 spaces\n std::cout &lt;&lt; std::setw(4) &lt;&lt; j &lt;&lt; '\\n';\n}\n</code></pre> <p>Output:</p> <pre><code>{\n \"answer\": {\n \"everything\": 42\n },\n \"happy\": true,\n \"list\": [\n 1,\n 0,\n 2\n ],\n \"name\": \"Niels\",\n \"new\": {\n \"key\": {\n \"value\": [\n \"another\",\n Line truncated
{"config":{"lang":["en"],"separator":"[\\s\\-\\.]","pipeline":["stopWordFilter"],"fields":{"title":{"boost":1000.0},"text":{"boost":1.0},"tags":{"boost":1000000.0}}},"docs":[{"location":"","title":"JSON for Modern C++","text":"<p>JSON for Modern C++ is a header-only C++11 library that turns JSON into a first-class C++ data type, using the operator magic of modern C++ so that creating, reading, and modifying JSON values feels as natural as it does in languages like Python. The whole library is available as a single header, <code>json.hpp</code>, with no dependencies, no subproject, and no complex build system to set up; a companion header, <code>json_fwd.hpp</code>, provides forward declarations to keep compile times down. See header-only integration for details. It is heavily unit-tested with 100% code coverage, checked with Valgrind and the Clang Sanitizers for memory leaks, and continuously fuzz-tested by Google OSS-Fuzz.</p>"},{"location":"#quick-start","title":"Quick start","text":"<p>Add the single header to your project and use the library like this:</p> <pre><code>#include &lt;iostream&gt;\n#include &lt;nlohmann/json.hpp&gt;\n\nusing json = nlohmann::json;\n\nint main()\n{\n // parse a JSON string\n json j = json::parse(R\"({\"happy\": true, \"pi\": 3.141})\");\n\n // access and modify values\n j[\"name\"] = \"Niels\";\n j[\"list\"] = {1, 0, 2};\n\n // serialize with an indent of 4 spaces\n std::cout &lt;&lt; j.dump(4) &lt;&lt; '\\n';\n}\n</code></pre> <p>Get the library by copying the single header <code>json.hpp</code> from the releases page into a directory <code>nlohmann</code> on your include path, or by installing it with a package manager:</p> <pre><code>brew install nlohmann-json # Homebrew\nvcpkg install nlohmann-json # vcpkg\n</code></pre> <pre><code>find_package(nlohmann_json 3.12.0 REQUIRED)\ntarget_link_libraries(myproject PRIVATE nlohmann_json::nlohmann_json)\n</code></pre> <p>See Integration for CMake in detail, all supported package managers (Conan, Meson, Bazel, Conda, and more), and pkg-config.</p>"},{"location":"#explore-the-documentation","title":"Explore the documentation","text":"<ul> <li> <p> Features</p> <p>Creating, parsing, accessing, and serializing JSON values, JSON Pointer/Patch, binary formats, and more.</p> <p> Features</p> </li> <li> <p> Integration</p> <p>Add the library to your project via a single header, CMake, a package manager, or pkg-config.</p> <p> Integration</p> </li> <li> <p> API documentation</p> <p>The complete reference for <code>basic_json</code> and its member functions, types, and related classes.</p> <p> API documentation</p> </li> <li> <p> FAQ</p> <p>Answers to common questions and known surprises when using the library.</p> <p> FAQ</p> </li> <li> <p> Releases</p> <p>What changed in each release, with links to the relevant documentation.</p> <p> Releases</p> </li> <li> <p> Community</p> <p>The ecosystem, contribution guidelines, governance, and quality assurance around the project.</p> <p> Community</p> </li> </ul> <p>Unreleased changes</p> <p>This documentation is built from the <code>develop</code> branch and may describe changes that are not part of a release yet. Their version numbers are followed by an unreleased badge; see Releases for what shipped in each version.</p> <p>The library is licensed under the MIT License. The source code, issue tracker, and discussions are on GitHub.</p>"},{"location":"api/json/","title":"nlohmann::json","text":"<pre><code>using json = basic_json&lt;&gt;;\n</code></pre> <p>This type is the default specialization of the basic_json class which uses the standard template types.</p>"},{"location":"api/json/#examples","title":"Examples","text":"Example <p>The example below demonstrates how to use the type <code>nlohmann::json</code>.</p> <pre><code>#include &lt;iostream&gt;\n#include &lt;iomanip&gt;\n#include &lt;nlohmann/json.hpp&gt;\n\nusing json = nlohmann::json;\n\nint main()\n{\n // create a JSON object\n json j =\n {\n {\"pi\", 3.141},\n {\"happy\", true},\n {\"name\", \"Niels\"},\n {\"nothing\", nullptr},\n {\n \"answer\", {\n {\"everything\", 42}\n }\n },\n {\"list\", {1, 0, 2}},\n {\n \"object\", {\n {\"currency\", \"USD\"},\n {\"value\", 42.99}\n }\n }\n };\n\n // add new values\n j[\"new\"][\"key\"][\"value\"] = {\"another\", \"list\"};\n\n // count elements\n auto s = j.size();\n j[\"size\"] = s;\n\n // pretty print with indent of 4 spaces\n std::cout &lt;&lt; std::setw(4) &lt;&lt; j &lt;&lt; '\\n';\n}\n</code></pre> <p>Output:</p> <pre><code>{\n \"answer\": {\n \"everything\": 42\n },\n \"happy\": true,\n \"list\": [\n 1,\n 0,\n 2\n ],\n \"name\": \"Niels\",\n \"new\": {\n \"key\": {\n \"value\": [\n \"another\",\n Line truncated
+276 -276
View File
File diff suppressed because it is too large. Load diff
BIN
View File
Binary file not shown.