This commit is contained in:
nlohmann committed 2026-08-07 17:31:54 +00:00
1 parent b2dfbf8855
commit b4e4dbe346
262 files changed
+819 -742

No files matched your search

+2 -2
View File
@@ -1,3 +1,3 @@
<!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/api/json_pointer/" rel="canonical"><link href=../json/ rel=prev><link href=json_pointer/ rel=next><link rel=icon href=../../assets/images/favicon.png><meta name=generator content="mkdocs-1.6.1, mkdocs-material-9.7.7"><title>Overview - 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=#nlohmannjson_pointer 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> Overview </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-Line 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/api/json_pointer/" rel="canonical"><link href=../json/ rel=prev><link href=json_pointer/ rel=next><link rel=icon href=../../assets/images/favicon.png><meta name=generator content="mkdocs-1.6.1, mkdocs-material-9.7.7"><title>Overview - 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=#nlohmannjson_pointer 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> Overview </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-Line truncated
<span class=k>class</span><span class=w> </span><span class=nc>json_pointer</span><span class=p>;</span>
</code></pre></div> <p>A <abbr title="JavaScript Object Notation">JSON</abbr> pointer defines a string syntax for identifying a specific value within a <abbr title="JavaScript Object Notation">JSON</abbr> document. It can be used with functions <a href=../basic_json/at/ ><code>at</code></a> and <a href=../basic_json/operator%5B%5D/ ><code>operator[]</code></a>. Furthermore, <abbr title="JavaScript Object Notation">JSON</abbr> pointers are the base for <abbr title="JavaScript Object Notation">JSON</abbr> patches.</p> <h2 id=template-parameters>Template parameters<a class=headerlink href=#template-parameters title="Permanent link">&para;</a></h2> <dl> <dt><code>RefStringType</code></dt> <dd>the string type used for the reference tokens making up the <abbr title="JavaScript Object Notation">JSON</abbr> pointer</dd> </dl> <div class="admonition warning"> <p class=admonition-title>Deprecation</p> <p>For backwards compatibility <code>RefStringType</code> may also be a specialization of <a href=../basic_json/ ><code>basic_json</code></a> in which case <code>string_t</code> will be deduced as <a href=../basic_json/string_t/ ><code>basic_json::string_t</code></a>. This feature is deprecated and may be removed in a future major version.</p> </div> <h2 id=member-types>Member types<a class=headerlink href=#member-types title="Permanent link">&para;</a></h2> <ul> <li><a href=string_t/ ><strong>string_t</strong></a> - the string type used for the reference tokens</li> </ul> <h2 id=member-functions>Member functions<a class=headerlink href=#member-functions title="Permanent link">&para;</a></h2> <ul> <li><a href=json_pointer/ >(constructor)</a></li> <li><a href=to_string/ ><strong>to_string</strong></a> - return a string representation of the <abbr title="JavaScript Object Notation">JSON</abbr> pointer</li> <li><a href=operator_string_t/ ><strong>operator string_t</strong></a> - return a string representation of the <abbr title="JavaScript Object Notation">JSON</abbr> pointer</li> <li><a href=operator_eq/ ><strong>operator==</strong></a> - compare: equal</li> <li><a href=operator_ne/ ><strong>operator!=</strong></a> - compare: not equal</li> <li><a href=operator_slasheq/ ><strong>operator/=</strong></a> - append to the end of the <abbr title="JavaScript Object Notation">JSON</abbr> pointer</li> <li><a href=operator_slash/ ><strong>operator/</strong></a> - create <abbr title="JavaScript Object Notation">JSON</abbr> Pointer by appending</li> <li><a href=parent_pointer/ ><strong>parent_pointer</strong></a> - returns the parent of this <abbr title="JavaScript Object Notation">JSON</abbr> pointer</li> <li><a href=pop_back/ ><strong>pop_back</strong></a> - remove the last reference token</li> <li><a href=back/ ><strong>back</strong></a> - return last reference token</li> <li><a href=push_back/ ><strong>push_back</strong></a> - append an unescaped token at the end of the pointer</li> <li><a href=pop_front/ ><strong>pop_front</strong></a> - remove the first reference token</li> <li><a href=front/ ><strong>front</strong></a> - return first reference token</li> <li><a href=push_front/ ><strong>push_front</strong></a> - append an unescaped token at the start of the pointer</li> <li><a href=empty/ ><strong>empty</strong></a> - return whether the pointer points to the root document</li> </ul> <h2 id=literals>Literals<a class=headerlink href=#literals title="Permanent link">&para;</a></h2> <ul> <li><a href=../operator_literal_json_pointer/ ><strong>operator""_json_pointer</strong></a> - user-defined string literal for <abbr title="JavaScript Object Notation">JSON</abbr> pointers</li> </ul> <h2 id=see-also>See also<a class=headerlink href=#see-also title="Permanent link">&para;</a></h2> <ul> <li><a href="https://datatracker.ietf.org/doc/html/rfc6901"><abbr title="Request for Comments">RFC</abbr> 6901</a></li> </ul> <h2 id=version-history>Version history<a class=headerlink href=#version-history title="Permanent link">&para;</a></h2> <ul> <li>Added in version 2.0.0.</li> <li>Changed template parameter from <code>basic_json</code> to string type in version 3.11.0.</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="August 5, 2026 11:44:15 UTC">August 5, 2026</span> </span> </aside> </article> </div> <script>var tabs=__md_get("__tabs");if(Array.isArray(tabs))e:for(var set of document.querySelectorAll(".tabbed-sLine truncated
</code></pre></div> <p>A <abbr title="JavaScript Object Notation">JSON</abbr> pointer defines a string syntax for identifying a specific value within a <abbr title="JavaScript Object Notation">JSON</abbr> document. It can be used with functions <a href=../basic_json/at/ ><code>at</code></a> and <a href=../basic_json/operator%5B%5D/ ><code>operator[]</code></a>. Furthermore, <abbr title="JavaScript Object Notation">JSON</abbr> pointers are the base for <abbr title="JavaScript Object Notation">JSON</abbr> patches.</p> <h2 id=template-parameters>Template parameters<a class=headerlink href=#template-parameters title="Permanent link">&para;</a></h2> <dl> <dt><code>RefStringType</code></dt> <dd>the string type used for the reference tokens making up the <abbr title="JavaScript Object Notation">JSON</abbr> pointer</dd> </dl> <div class="admonition warning"> <p class=admonition-title>Deprecation</p> <p>For backwards compatibility <code>RefStringType</code> may also be a specialization of <a href=../basic_json/ ><code>basic_json</code></a> in which case <code>string_t</code> will be deduced as <a href=../basic_json/string_t/ ><code>basic_json::string_t</code></a>. This feature is deprecated and may be removed in a future major version.</p> </div> <h2 id=member-types>Member types<a class=headerlink href=#member-types title="Permanent link">&para;</a></h2> <ul> <li><a href=string_t/ ><strong>string_t</strong></a> - the string type used for the reference tokens</li> </ul> <h2 id=member-functions>Member functions<a class=headerlink href=#member-functions title="Permanent link">&para;</a></h2> <ul> <li><a href=json_pointer/ >(constructor)</a></li> <li><a href=to_string/ ><strong>to_string</strong></a> - return a string representation of the <abbr title="JavaScript Object Notation">JSON</abbr> pointer</li> <li><a href=operator_string_t/ ><strong>operator string_t</strong></a> - return a string representation of the <abbr title="JavaScript Object Notation">JSON</abbr> pointer</li> <li><a href=operator_eq/ ><strong>operator==</strong></a> - compare: equal</li> <li><a href=operator_ne/ ><strong>operator!=</strong></a> - compare: not equal</li> <li><a href=operator_slasheq/ ><strong>operator/=</strong></a> - append to the end of the <abbr title="JavaScript Object Notation">JSON</abbr> pointer</li> <li><a href=operator_slash/ ><strong>operator/</strong></a> - create <abbr title="JavaScript Object Notation">JSON</abbr> Pointer by appending</li> <li><a href=parent_pointer/ ><strong>parent_pointer</strong></a> - returns the parent of this <abbr title="JavaScript Object Notation">JSON</abbr> pointer</li> <li><a href=pop_back/ ><strong>pop_back</strong></a> - remove the last reference token</li> <li><a href=back/ ><strong>back</strong></a> - return last reference token</li> <li><a href=push_back/ ><strong>push_back</strong></a> - append an unescaped token at the end of the pointer</li> <li><a href=pop_front/ ><strong>pop_front</strong></a> - remove the first reference token</li> <li><a href=front/ ><strong>front</strong></a> - return first reference token</li> <li><a href=push_front/ ><strong>push_front</strong></a> - append an unescaped token at the start of the pointer</li> <li><a href=empty/ ><strong>empty</strong></a> - return whether the pointer points to the root document</li> </ul> <h2 id=literals>Literals<a class=headerlink href=#literals title="Permanent link">&para;</a></h2> <ul> <li><a href=../operator_literal_json_pointer/ ><strong>operator""_json_pointer</strong></a> - user-defined string literal for <abbr title="JavaScript Object Notation">JSON</abbr> pointers</li> </ul> <h2 id=see-also>See also<a class=headerlink href=#see-also title="Permanent link">&para;</a></h2> <ul> <li><a href="https://datatracker.ietf.org/doc/html/rfc6901"><abbr title="Request for Comments">RFC</abbr> 6901</a></li> </ul> <h2 id=version-history>Version history<a class=headerlink href=#version-history title="Permanent link">&para;</a></h2> <ul> <li>Added in version 2.0.0.</li> <li>Changed template parameter from <code>basic_json</code> to string type in version 3.11.0.</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="August 7, 2026 17:29:58 UTC">August 7, 2026</span> </span> </aside> </article> </div> <script>var tabs=__md_get("__tabs");if(Array.isArray(tabs))e:for(var set of document.querySelectorAll(".tabbed-sLine truncated