<!doctype html><htmllang=enclass=no-js><head><metacharset=utf-8><metaname=viewportcontent="width=device-width,initial-scale=1"><metaname=authorcontent="Niels Lohmann"><linkhref=https://json.nlohmann.me/api/macros/nlohmann_json_namespace/rel=canonical><linkhref=../nlohmann_define_type_non_intrusive/rel=prev><linkhref=../nlohmann_json_namespace_begin/rel=next><linkrel=iconhref=../../../assets/images/favicon.png><metaname=generatorcontent="mkdocs-1.5.3, mkdocs-material-9.4.7"><title>NLOHMANN_JSON_NAMESPACE - JSON for Modern C++</title><linkrel=stylesheethref=../../../assets/stylesheets/main.4b4a2bd9.min.css><linkrel=stylesheethref=../../../assets/stylesheets/palette.356b1318.min.css><linkrel=preconnecthref=https://fonts.gstatic.comcrossorigin><linkrel=stylesheethref="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CJetBrains+Mono:400,400i,700,700i&display=fallback"><style>:root{--md-text-font:"Roboto";--md-code-font:"JetBrains Mono"}</style><linkrel=stylesheethref=../../../css/custom.css><script>__md_scope=newURL("../../..",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><bodydir=ltrdata-md-color-scheme=defaultdata-md-color-primary=indigodata-md-color-accent=indigo><script>varpalette=__md_get("__palette");if(palette&&"object"==typeofpalette.color)for(varkeyofObject.keys(palette.color))document.body.setAttribute("data-md-color-"+key,palette.color[key])</script><inputclass=md-toggledata-md-toggle=drawertype=checkboxid=__drawerautocomplete=off><inputclass=md-toggledata-md-toggle=searchtype=checkboxid=__searchautocomplete=off><labelclass=md-overlayfor=__drawer></label><divdata-md-component=skip><ahref=#nlohmann_json_namespaceclass=md-skip> Skip to content </a></div><divdata-md-component=announce></div><headerclass=md-headerdata-md-component=header><navclass="md-header__inner md-grid"aria-label=Header><ahref=../../..title="JSON for Modern C++"class="md-header__button md-logo"aria-label="JSON for Modern C++"data-md-component=logo><svgxmlns=http://www.w3.org/2000/svgviewbox="0 0 24 24"><pathd="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.54Z"/></svg></a><labelclass="md-header__button md-icon"for=__drawer><svgxmlns=http://www.w3.org/2000/svgviewbox="0 0 24 24"><pathd="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"/></svg></label><divclass=md-header__titledata-md-component=header-title><divclass=md-header__ellipsis><divclass=md-header__topic><spanclass=md-ellipsis> JSON for Modern C++ </span></div><divclass=md-header__topicdata-md-component=header-topic><spanclass=md-ellipsis> NLOHMANN_JSON_NAMESPACE </span></div></div></div><formclass=md-header__optiondata-md-component=palette><inputclass=md-optiondata-md-color-media="(prefers-color-scheme: light)"data-md-color-scheme=defaultdata-md-color-primary=indigodata-md-color-accent=indigoaria-label="Switch to dark mode"type=radioname=__paletteid=__palette_1><labelclass="md-header__button md-icon"title="Switch to dark mode"for=__palette_2hidden><svgxmlns=http://www.w3.org/2000/svgviewbox="0 0 24 24"><pathd="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 12 20 8.69Z"/></svg></label><inputclass=md-optiondata-md-color-media="(prefers-color-scheme: dark)"data-md-color-scheme=slatedata-md-color-primary=indigodata-md-color-accent=indigoaria-label="Switch to light mode"type=radioname=__paletteid=__palette_2><labelclass="md-header__button md-icon"title="Switch to light mode"for=__palette_1hidden><svgxmlns=http://www.w3.org/2
</code></pre></div><p>This macro evaluates to the full name of the <code>nlohmann</code> namespace.</p><h2id=default-definition>Default definition<aclass=headerlinkhref=#default-definitiontitle="Permanent link">¶</a></h2><p>The default value consists of the root namespace (<code>nlohmann</code>) and an inline ABI namespace. See <ahref=../../../features/namespace/#structure><code>nlohmann</code> Namespace</a> for details.</p><p>When the macro is not defined, the library will define it to its default value. Overriding this value has no effect on the library.</p><h2id=examples>Examples<aclass=headerlinkhref=#examplestitle="Permanent link">¶</a></h2><detailsclass=example><summary>Example</summary><p>The example shows how to use <code>NLOHMANN_JSON_NAMESPACE</code> instead of just <code>nlohmann</code>, as well as how to output the value of <code>NLOHMANN_JSON_NAMESPACE</code>.</p><divclass=highlight><pre><span></span><code><spanclass=cp>#include</span><spanclass=w></span><spanclass=cpf><iostream></span>