<!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/basic_json/meta/rel=canonical><linkrel=iconhref=../../../assets/images/favicon.png><metaname=generatorcontent="mkdocs-1.4.2, mkdocs-material-8.5.10"><title>meta - JSON for Modern C++</title><linkrel=stylesheethref=../../../assets/stylesheets/main.975780f9.min.css><linkrel=stylesheethref=../../../assets/stylesheets/palette.2505c338.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=#nlohmannbasic_jsonmetaclass=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> meta </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/2000/svgviewbox="0 0 24 24"><pathd="M1218c-.890-1.74-.2-2.5-.55C11.5616.51314.421312c0-2.42-1.44-4.5-3.5-5.45C10.266.211.116126a660016666001-6
</code></pre></div><p>This function returns a JSON object with information about the library, including the version number and information on the platform and compiler.</p><h2id=return-value>Return value<aclass=headerlinkhref=#return-valuetitle="Permanent link">¶</a></h2><p>JSON object holding version information</p><table><thead><tr><th>key</th><th>description</th></tr></thead><tbody><tr><td><code>compiler</code></td><td>Information on the used compiler. It is an object with the following keys: <code>c++</code> (the used C++ standard), <code>family</code> (the compiler family; possible values are <code>clang</code>, <code>icc</code>, <code>gcc</code>, <code>ilecpp</code>, <code>msvc</code>, <code>pgcpp</code>, <code>sunpro</code>, and <code>unknown</code>), and <code>version</code> (the compiler version).</td></tr><tr><td><code>copyright</code></td><td>The copyright line for the library as string.</td></tr><tr><td><code>name</code></td><td>The name of the library as string.</td></tr><tr><td><code>platform</code></td><td>The used platform as string. Possible values are <code>win32</code>, <code>linux</code>, <code>apple</code>, <code>unix</code>, and <code>unknown</code>.</td></tr><tr><td><code>url</code></td><td>The URL of the project as string.</td></tr><tr><td><code>version</code></td><td>The version of the library. It is an object with the following keys: <code>major</code>, <code>minor</code>, and <code>patch</code> as defined by <ahref=http://semver.org>Semantic Versioning</a>, and <code>string</code> (the version string).</td></tr></tbody></table><h2id=exception-safety>Exception safety<aclass=headerlinkhref=#exception-safetytitle="Permanent link">¶</a></h2><p>Strong guarantee: if an exception is thrown, there are no changes to any JSON value.</p><h2id=complexity>Complexity<aclass=headerlinkhref=#complexitytitle="Permanent link">¶</a></h2><p>Constant.</p><h2id=examples>Examples<aclass=headerlinkhref=#examplestitle="Permanent link">¶</a></h2><detailsclass=example><summary>Example</summary><p>The following code shows an example output of the <code>meta()</code> function.</p><divclass=highlight><pre><span></span><code><spanclass=cp>#include</span><spanclass=w></span><spanclass=cpf><iostream></span><spanclass=cp></span>
<spanclass=w></span><spanclass=nt>"name"</span><spanclass=p>:</span><spanclass=w></span><spanclass=s2>"JSON for Modern C++"</span><spanclass=p>,</span><spanclass=w></span>