mirror of
https://github.com/nlohmann/json.git
synced 2024-11-28 00:59:02 +08:00
5 lines
50 KiB
HTML
5 lines
50 KiB
HTML
<!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/integration/ rel=canonical><link rel=icon href=../assets/images/favicon.png><meta name=generator content="mkdocs-1.4.2, mkdocs-material-8.5.10"><title>Header only - JSON for Modern C++</title><link rel=stylesheet href=../assets/stylesheets/main.975780f9.min.css><link rel=stylesheet href=../assets/stylesheets/palette.2505c338.min.css><link rel=preconnect href=https://fonts.gstatic.com crossorigin><link rel=stylesheet href="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><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> <script>var palette=__md_get("__palette");if(palette&&"object"==typeof palette.color)for(var key of Object.keys(palette.color))document.body.setAttribute("data-md-color-"+key,palette.color[key])</script> <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=#header-only 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.54Z"/></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 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"/></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> Header only </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_1> <label class="md-header__button md-icon" title="Switch to dark mode" for=__palette_2 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 12 20 8.69Z"/></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_2> <label class="md-header__button md-icon" title="Switch to light mode" for=__palette_1 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 12c0-2.42-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 12 20 8.69Z"/></svg> </label> </form> <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.516 6.516 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 5Z"/></svg> </label> <div class=md-search data-md-component=search role=dialog> <label class=md-search__overlay for=__search></label> <div class=md-search__inner role=search> <form class=md-search__form name=search> <input type=text class=md-search__input name=query aria-label=Search placeholder=Search autocapitalize=off autocorrect=off autocomplete=off spellcheck=false data-md-component=search-query required> <label class="md-search__icon 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.516 6.516 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 5Z"/></svg> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12Z"/></svg> </label> <nav class=md-search__options aria-label=Search> <button type=reset class="md-search__icon md-icon" title=Clear aria-label=Clear tabindex=-1> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41Z"/></svg> </button> </nav> </form> <div class=md-search__output> <div class=md-search__scrollwrap data-md-scrollfix> <div class=md-search-result data-md-component=search-result> <div class=md-search-result__meta> Initializing search </div> <ol class=md-search-result__list></ol> </div> </div> </div> </div> </div> <div class=md-header__source> <a href=https://github.com/nlohmann/json title="Go to repository" class=md-source data-md-component=source> <div class="md-source__icon md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 448 512"><!-- Font Awesome Free 6.2.1 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 2022 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg> </div> <div class=md-source__repository> nlohmann/json </div> </a> </div> </nav> </header> <div class=md-container data-md-component=container> <nav class=md-tabs aria-label=Tabs data-md-component=tabs> <div class="md-tabs__inner md-grid"> <ul class=md-tabs__list> <li class=md-tabs__item> <a href=.. class=md-tabs__link> Home </a> </li> <li class=md-tabs__item> <a href=../features/arbitrary_types/ class=md-tabs__link> Features </a> </li> <li class=md-tabs__item> <a href=./ class="md-tabs__link md-tabs__link--active"> Integration </a> </li> <li class=md-tabs__item> <a href=../api/basic_json/ class=md-tabs__link> API Documentation </a> </li> </ul> </div> </nav> <main class=md-main data-md-component=main> <div class="md-main__inner md-grid"> <div class="md-sidebar md-sidebar--primary" data-md-component=sidebar data-md-type=navigation> <div class=md-sidebar__scrollwrap> <div class=md-sidebar__inner> <nav class="md-nav md-nav--primary md-nav--lifted" aria-label=Navigation data-md-level=0> <label class=md-nav__title for=__drawer> <a href=.. title="JSON for Modern C++" class="md-nav__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.54Z"/></svg> </a> JSON for Modern C++ </label> <div class=md-nav__source> <a href=https://github.com/nlohmann/json title="Go to repository" class=md-source data-md-component=source> <div class="md-source__icon md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 448 512"><!-- Font Awesome Free 6.2.1 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 2022 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg> </div> <div class=md-source__repository> nlohmann/json </div> </a> </div> <ul class=md-nav__list data-md-scrollfix> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle" data-md-toggle=__nav_1 type=checkbox id=__nav_1> <div class="md-nav__link md-nav__link--index "> <a href=..>Home</a> <label for=__nav_1> <span class="md-nav__icon md-icon"></span> </label> </div> <nav class=md-nav aria-label=Home data-md-level=1> <label class=md-nav__title for=__nav_1> <span class="md-nav__icon md-icon"></span> Home </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../home/license/ class=md-nav__link> License </a> </li> <li class=md-nav__item> <a href=../home/code_of_conduct/ class=md-nav__link> Code of Conduct </a> </li> <li class=md-nav__item> <a href=../home/faq/ class=md-nav__link> FAQ </a> </li> <li class=md-nav__item> <a href=../home/exceptions/ class=md-nav__link> Exceptions </a> </li> <li class=md-nav__item> <a href=../home/releases/ class=md-nav__link> Releases </a> </li> <li class=md-nav__item> <a href=../home/design_goals/ class=md-nav__link> Design goals </a> </li> <li class=md-nav__item> <a href=../home/sponsors/ class=md-nav__link> Sponsors </a> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle" data-md-toggle=__nav_2 type=checkbox id=__nav_2> <label class=md-nav__link for=__nav_2> Features <span class="md-nav__icon md-icon"></span> </label> <nav class=md-nav aria-label=Features data-md-level=1> <label class=md-nav__title for=__nav_2> <span class="md-nav__icon md-icon"></span> Features </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../features/arbitrary_types/ class=md-nav__link> Arbitrary Type Conversions </a> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle" data-md-toggle=__nav_2_2 type=checkbox id=__nav_2_2> <div class="md-nav__link md-nav__link--index "> <a href=../features/binary_formats/ >Binary Formats</a> <label for=__nav_2_2> <span class="md-nav__icon md-icon"></span> </label> </div> <nav class=md-nav aria-label="Binary Formats" data-md-level=2> <label class=md-nav__title for=__nav_2_2> <span class="md-nav__icon md-icon"></span> Binary Formats </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../features/binary_formats/bjdata/ class=md-nav__link> BJData </a> </li> <li class=md-nav__item> <a href=../features/binary_formats/bson/ class=md-nav__link> BSON </a> </li> <li class=md-nav__item> <a href=../features/binary_formats/cbor/ class=md-nav__link> CBOR </a> </li> <li class=md-nav__item> <a href=../features/binary_formats/messagepack/ class=md-nav__link> MessagePack </a> </li> <li class=md-nav__item> <a href=../features/binary_formats/ubjson/ class=md-nav__link> UBJSON </a> </li> </ul> </nav> </li> <li class=md-nav__item> <a href=../features/binary_values/ class=md-nav__link> Binary Values </a> </li> <li class=md-nav__item> <a href=../features/comments/ class=md-nav__link> Comments </a> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle" data-md-toggle=__nav_2_5 type=checkbox id=__nav_2_5> <div class="md-nav__link md-nav__link--index "> <a href=../features/element_access/ >Element Access</a> <label for=__nav_2_5> <span class="md-nav__icon md-icon"></span> </label> </div> <nav class=md-nav aria-label="Element Access" data-md-level=2> <label class=md-nav__title for=__nav_2_5> <span class="md-nav__icon md-icon"></span> Element Access </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../features/element_access/unchecked_access/ class=md-nav__link> Unchecked access: operator[] </a> </li> <li class=md-nav__item> <a href=../features/element_access/checked_access/ class=md-nav__link> Checked access: at </a> </li> <li class=md-nav__item> <a href=../features/element_access/default_value/ class=md-nav__link> Access with default value: value </a> </li> </ul> </nav> </li> <li class=md-nav__item> <a href=../features/iterators/ class=md-nav__link> Iterators </a> </li> <li class=md-nav__item> <a href=../features/json_pointer/ class=md-nav__link> JSON Pointer </a> </li> <li class=md-nav__item> <a href=../features/json_patch/ class=md-nav__link> JSON Patch and Diff </a> </li> <li class=md-nav__item> <a href=../features/merge_patch/ class=md-nav__link> JSON Merge Patch </a> </li> <li class=md-nav__item> <a href=../features/namespace/ class=md-nav__link> nlohmann Namespace </a> </li> <li class=md-nav__item> <a href=../features/object_order/ class=md-nav__link> Object Order </a> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle" data-md-toggle=__nav_2_12 type=checkbox id=__nav_2_12> <div class="md-nav__link md-nav__link--index "> <a href=../features/parsing/ >Parsing</a> <label for=__nav_2_12> <span class="md-nav__icon md-icon"></span> </label> </div> <nav class=md-nav aria-label=Parsing data-md-level=2> <label class=md-nav__title for=__nav_2_12> <span class="md-nav__icon md-icon"></span> Parsing </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../features/parsing/json_lines/ class=md-nav__link> JSON Lines </a> </li> <li class=md-nav__item> <a href=../features/parsing/parse_exceptions/ class=md-nav__link> Parsing and Exceptions </a> </li> <li class=md-nav__item> <a href=../features/parsing/parser_callbacks/ class=md-nav__link> Parser Callbacks </a> </li> <li class=md-nav__item> <a href=../features/parsing/sax_interface/ class=md-nav__link> SAX Interface </a> </li> </ul> </nav> </li> <li class=md-nav__item> <a href=../features/assertions/ class=md-nav__link> Runtime Assertions </a> </li> <li class=md-nav__item> <a href=../features/enum_conversion/ class=md-nav__link> Specializing enum conversion </a> </li> <li class=md-nav__item> <a href=../features/macros/ class=md-nav__link> Supported Macros </a> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle" data-md-toggle=__nav_2_16 type=checkbox id=__nav_2_16> <div class="md-nav__link md-nav__link--index "> <a href=../features/types/ >Types</a> <label for=__nav_2_16> <span class="md-nav__icon md-icon"></span> </label> </div> <nav class=md-nav aria-label=Types data-md-level=2> <label class=md-nav__title for=__nav_2_16> <span class="md-nav__icon md-icon"></span> Types </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../features/types/number_handling/ class=md-nav__link> Number Handling </a> </li> </ul> </nav> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--active md-nav__item--nested"> <input class="md-nav__toggle md-toggle" data-md-toggle=__nav_3 type=checkbox id=__nav_3 checked> <div class="md-nav__link md-nav__link--index md-nav__link--active"> <a href=./ >Integration</a> <label for=__nav_3> <span class="md-nav__icon md-icon"></span> </label> </div> <nav class=md-nav aria-label=Integration data-md-level=1> <label class=md-nav__title for=__nav_3> <span class="md-nav__icon md-icon"></span> Integration </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=migration_guide/ class=md-nav__link> Migration Guide </a> </li> <li class=md-nav__item> <a href=cmake/ class=md-nav__link> CMake </a> </li> <li class=md-nav__item> <a href=package_managers/ class=md-nav__link> Package Managers </a> </li> <li class=md-nav__item> <a href=pkg-config/ class=md-nav__link> Pkg-config </a> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle" data-md-toggle=__nav_4 type=checkbox id=__nav_4> <label class=md-nav__link for=__nav_4> API Documentation <span class="md-nav__icon md-icon"></span> </label> <nav class=md-nav aria-label="API Documentation" data-md-level=1> <label class=md-nav__title for=__nav_4> <span class="md-nav__icon md-icon"></span> API Documentation </label> <ul class=md-nav__list data-md-scrollfix> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle" data-md-toggle=__nav_4_1 type=checkbox id=__nav_4_1> <div class="md-nav__link md-nav__link--index "> <a href=../api/basic_json/ >basic_json</a> <label for=__nav_4_1> <span class="md-nav__icon md-icon"></span> </label> </div> <nav class=md-nav aria-label=basic_json data-md-level=2> <label class=md-nav__title for=__nav_4_1> <span class="md-nav__icon md-icon"></span> basic_json </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../api/basic_json/basic_json/ class=md-nav__link> (Constructor) </a> </li> <li class=md-nav__item> <a href=../api/basic_json/~basic_json/ class=md-nav__link> (Destructor) </a> </li> <li class=md-nav__item> <a href=../api/basic_json/accept/ class=md-nav__link> accept </a> </li> <li class=md-nav__item> <a href=../api/basic_json/array/ class=md-nav__link> array </a> </li> <li class=md-nav__item> <a href=../api/basic_json/array_t/ class=md-nav__link> array_t </a> </li> <li class=md-nav__item> <a href=../api/basic_json/at/ class=md-nav__link> at </a> </li> <li class=md-nav__item> <a href=../api/basic_json/back/ class=md-nav__link> back </a> </li> <li class=md-nav__item> <a href=../api/basic_json/begin/ class=md-nav__link> begin </a> </li> <li class=md-nav__item> <a href=../api/basic_json/binary/ class=md-nav__link> binary </a> </li> <li class=md-nav__item> <a href=../api/basic_json/binary_t/ class=md-nav__link> binary_t </a> </li> <li class=md-nav__item> <a href=../api/basic_json/boolean_t/ class=md-nav__link> boolean_t </a> </li> <li class=md-nav__item> <a href=../api/basic_json/cbegin/ class=md-nav__link> cbegin </a> </li> <li class=md-nav__item> <a href=../api/basic_json/cbor_tag_handler_t/ class=md-nav__link> cbor_tag_handler_t </a> </li> <li class=md-nav__item> <a href=../api/basic_json/cend/ class=md-nav__link> cend </a> </li> <li class=md-nav__item> <a href=../api/basic_json/clear/ class=md-nav__link> clear </a> </li> <li class=md-nav__item> <a href=../api/basic_json/contains/ class=md-nav__link> contains </a> </li> <li class=md-nav__item> <a href=../api/basic_json/count/ class=md-nav__link> count </a> </li> <li class=md-nav__item> <a href=../api/basic_json/crbegin/ class=md-nav__link> crbegin </a> </li> <li class=md-nav__item> <a href=../api/basic_json/crend/ class=md-nav__link> crend </a> </li> <li class=md-nav__item> <a href=../api/basic_json/default_object_comparator_t/ class=md-nav__link> default_object_comparator_t </a> </li> <li class=md-nav__item> <a href=../api/basic_json/diff/ class=md-nav__link> diff </a> </li> <li class=md-nav__item> <a href=../api/basic_json/dump/ class=md-nav__link> dump </a> </li> <li class=md-nav__item> <a href=../api/basic_json/emplace/ class=md-nav__link> emplace </a> </li> <li class=md-nav__item> <a href=../api/basic_json/emplace_back/ class=md-nav__link> emplace_back </a> </li> <li class=md-nav__item> <a href=../api/basic_json/empty/ class=md-nav__link> empty </a> </li> <li class=md-nav__item> <a href=../api/basic_json/end/ class=md-nav__link> end </a> </li> <li class=md-nav__item> <a href=../api/basic_json/erase/ class=md-nav__link> erase </a> </li> <li class=md-nav__item> <a href=../api/basic_json/error_handler_t/ class=md-nav__link> error_handler_t </a> </li> <li class=md-nav__item> <a href=../api/basic_json/exception/ class=md-nav__link> exception </a> </li> <li class=md-nav__item> <a href=../api/basic_json/find/ class=md-nav__link> find </a> </li> <li class=md-nav__item> <a href=../api/basic_json/flatten/ class=md-nav__link> flatten </a> </li> <li class=md-nav__item> <a href=../api/basic_json/from_bjdata/ class=md-nav__link> from_bjdata </a> </li> <li class=md-nav__item> <a href=../api/basic_json/from_bson/ class=md-nav__link> from_bson </a> </li> <li class=md-nav__item> <a href=../api/basic_json/from_cbor/ class=md-nav__link> from_cbor </a> </li> <li class=md-nav__item> <a href=../api/basic_json/from_msgpack/ class=md-nav__link> from_msgpack </a> </li> <li class=md-nav__item> <a href=../api/basic_json/from_ubjson/ class=md-nav__link> from_ubjson </a> </li> <li class=md-nav__item> <a href=../api/basic_json/front/ class=md-nav__link> front </a> </li> <li class=md-nav__item> <a href=../api/basic_json/get/ class=md-nav__link> get </a> </li> <li class=md-nav__item> <a href=../api/basic_json/get_allocator/ class=md-nav__link> get_allocator </a> </li> <li class=md-nav__item> <a href=../api/basic_json/get_binary/ class=md-nav__link> get_binary </a> </li> <li class=md-nav__item> <a href=../api/basic_json/get_ptr/ class=md-nav__link> get_ptr </a> </li> <li class=md-nav__item> <a href=../api/basic_json/get_ref/ class=md-nav__link> get_ref </a> </li> <li class=md-nav__item> <a href=../api/basic_json/get_to/ class=md-nav__link> get_to </a> </li> <li class=md-nav__item> <a href=../api/basic_json/std_hash/ class=md-nav__link> std::hash<basic_json> </a> </li> <li class=md-nav__item> <a href=../api/basic_json/input_format_t/ class=md-nav__link> input_format_t </a> </li> <li class=md-nav__item> <a href=../api/basic_json/insert/ class=md-nav__link> insert </a> </li> <li class=md-nav__item> <a href=../api/basic_json/invalid_iterator/ class=md-nav__link> invalid_iterator </a> </li> <li class=md-nav__item> <a href=../api/basic_json/is_array/ class=md-nav__link> is_array </a> </li> <li class=md-nav__item> <a href=../api/basic_json/is_binary/ class=md-nav__link> is_binary </a> </li> <li class=md-nav__item> <a href=../api/basic_json/is_boolean/ class=md-nav__link> is_boolean </a> </li> <li class=md-nav__item> <a href=../api/basic_json/is_discarded/ class=md-nav__link> is_discarded </a> </li> <li class=md-nav__item> <a href=../api/basic_json/is_null/ class=md-nav__link> is_null </a> </li> <li class=md-nav__item> <a href=../api/basic_json/is_number/ class=md-nav__link> is_number </a> </li> <li class=md-nav__item> <a href=../api/basic_json/is_number_float/ class=md-nav__link> is_number_float </a> </li> <li class=md-nav__item> <a href=../api/basic_json/is_number_integer/ class=md-nav__link> is_number_integer </a> </li> <li class=md-nav__item> <a href=../api/basic_json/is_number_unsigned/ class=md-nav__link> is_number_unsigned </a> </li> <li class=md-nav__item> <a href=../api/basic_json/is_object/ class=md-nav__link> is_object </a> </li> <li class=md-nav__item> <a href=../api/basic_json/is_primitive/ class=md-nav__link> is_primitive </a> </li> <li class=md-nav__item> <a href=../api/basic_json/is_string/ class=md-nav__link> is_string </a> </li> <li class=md-nav__item> <a href=../api/basic_json/is_structured/ class=md-nav__link> is_structured </a> </li> <li class=md-nav__item> <a href=../api/basic_json/items/ class=md-nav__link> items </a> </li> <li class=md-nav__item> <a href=../api/basic_json/json_base_class_t/ class=md-nav__link> json_base_class_t </a> </li> <li class=md-nav__item> <a href=../api/basic_json/json_serializer/ class=md-nav__link> json_serializer </a> </li> <li class=md-nav__item> <a href=../api/basic_json/max_size/ class=md-nav__link> max_size </a> </li> <li class=md-nav__item> <a href=../api/basic_json/meta/ class=md-nav__link> meta </a> </li> <li class=md-nav__item> <a href=../api/basic_json/merge_patch/ class=md-nav__link> merge_patch </a> </li> <li class=md-nav__item> <a href=../api/basic_json/number_float_t/ class=md-nav__link> number_float_t </a> </li> <li class=md-nav__item> <a href=../api/basic_json/number_integer_t/ class=md-nav__link> number_integer_t </a> </li> <li class=md-nav__item> <a href=../api/basic_json/number_unsigned_t/ class=md-nav__link> number_unsigned_t </a> </li> <li class=md-nav__item> <a href=../api/basic_json/object/ class=md-nav__link> object </a> </li> <li class=md-nav__item> <a href=../api/basic_json/object_comparator_t/ class=md-nav__link> object_comparator_t </a> </li> <li class=md-nav__item> <a href=../api/basic_json/object_t/ class=md-nav__link> object_t </a> </li> <li class=md-nav__item> <a href=../api/basic_json/operator_ValueType/ class=md-nav__link> operator ValueType </a> </li> <li class=md-nav__item> <a href=../api/basic_json/operator_value_t/ class=md-nav__link> operator value_t </a> </li> <li class=md-nav__item> <a href=../api/basic_json/operator%5B%5D/ class=md-nav__link> operator[] </a> </li> <li class=md-nav__item> <a href=../api/basic_json/operator%3D/ class=md-nav__link> operator= </a> </li> <li class=md-nav__item> <a href=../api/basic_json/operator%2B%3D/ class=md-nav__link> operator+= </a> </li> <li class=md-nav__item> <a href=../api/basic_json/operator_eq/ class=md-nav__link> operator== </a> </li> <li class=md-nav__item> <a href=../api/basic_json/operator_ne/ class=md-nav__link> operator!= </a> </li> <li class=md-nav__item> <a href=../api/basic_json/operator_lt/ class=md-nav__link> operator< </a> </li> <li class=md-nav__item> <a href=../api/basic_json/operator_gt/ class=md-nav__link> operator> </a> </li> <li class=md-nav__item> <a href=../api/basic_json/operator_le/ class=md-nav__link> operator<= </a> </li> <li class=md-nav__item> <a href=../api/basic_json/operator_ge/ class=md-nav__link> operator>= </a> </li> <li class=md-nav__item> <a href=../api/basic_json/operator_spaceship/ class=md-nav__link> operator<=> </a> </li> <li class=md-nav__item> <a href=../api/basic_json/out_of_range/ class=md-nav__link> out_of_range </a> </li> <li class=md-nav__item> <a href=../api/basic_json/other_error/ class=md-nav__link> other_error </a> </li> <li class=md-nav__item> <a href=../api/basic_json/parse/ class=md-nav__link> parse </a> </li> <li class=md-nav__item> <a href=../api/basic_json/parse_error/ class=md-nav__link> parse_error </a> </li> <li class=md-nav__item> <a href=../api/basic_json/parse_event_t/ class=md-nav__link> parse_event_t </a> </li> <li class=md-nav__item> <a href=../api/basic_json/parser_callback_t/ class=md-nav__link> parser_callback_t </a> </li> <li class=md-nav__item> <a href=../api/basic_json/patch/ class=md-nav__link> patch </a> </li> <li class=md-nav__item> <a href=../api/basic_json/patch_inplace/ class=md-nav__link> patch_inplace </a> </li> <li class=md-nav__item> <a href=../api/basic_json/push_back/ class=md-nav__link> push_back </a> </li> <li class=md-nav__item> <a href=../api/basic_json/rbegin/ class=md-nav__link> rbegin </a> </li> <li class=md-nav__item> <a href=../api/basic_json/rend/ class=md-nav__link> rend </a> </li> <li class=md-nav__item> <a href=../api/basic_json/sax_parse/ class=md-nav__link> sax_parse </a> </li> <li class=md-nav__item> <a href=../api/basic_json/size/ class=md-nav__link> size </a> </li> <li class=md-nav__item> <a href=../api/basic_json/string_t/ class=md-nav__link> string_t </a> </li> <li class=md-nav__item> <a href=../api/basic_json/swap/ class=md-nav__link> swap </a> </li> <li class=md-nav__item> <a href=../api/basic_json/std_swap/ class=md-nav__link> std::swap<basic_json> </a> </li> <li class=md-nav__item> <a href=../api/basic_json/to_bjdata/ class=md-nav__link> to_bjdata </a> </li> <li class=md-nav__item> <a href=../api/basic_json/to_bson/ class=md-nav__link> to_bson </a> </li> <li class=md-nav__item> <a href=../api/basic_json/to_cbor/ class=md-nav__link> to_cbor </a> </li> <li class=md-nav__item> <a href=../api/basic_json/to_msgpack/ class=md-nav__link> to_msgpack </a> </li> <li class=md-nav__item> <a href=../api/basic_json/to_string/ class=md-nav__link> to_string </a> </li> <li class=md-nav__item> <a href=../api/basic_json/to_ubjson/ class=md-nav__link> to_ubjson </a> </li> <li class=md-nav__item> <a href=../api/basic_json/type/ class=md-nav__link> type </a> </li> <li class=md-nav__item> <a href=../api/basic_json/type_error/ class=md-nav__link> type_error </a> </li> <li class=md-nav__item> <a href=../api/basic_json/type_name/ class=md-nav__link> type_name </a> </li> <li class=md-nav__item> <a href=../api/basic_json/unflatten/ class=md-nav__link> unflatten </a> </li> <li class=md-nav__item> <a href=../api/basic_json/update/ class=md-nav__link> update </a> </li> <li class=md-nav__item> <a href=../api/basic_json/value/ class=md-nav__link> value </a> </li> <li class=md-nav__item> <a href=../api/basic_json/value_t/ class=md-nav__link> value_t </a> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle" data-md-toggle=__nav_4_2 type=checkbox id=__nav_4_2> <div class="md-nav__link md-nav__link--index "> <a href=../api/byte_container_with_subtype/ >byte_container_with_subtype</a> <label for=__nav_4_2> <span class="md-nav__icon md-icon"></span> </label> </div> <nav class=md-nav aria-label=byte_container_with_subtype data-md-level=2> <label class=md-nav__title for=__nav_4_2> <span class="md-nav__icon md-icon"></span> byte_container_with_subtype </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../api/byte_container_with_subtype/byte_container_with_subtype/ class=md-nav__link> (constructor) </a> </li> <li class=md-nav__item> <a href=../api/byte_container_with_subtype/clear_subtype/ class=md-nav__link> clear_subtype </a> </li> <li class=md-nav__item> <a href=../api/byte_container_with_subtype/has_subtype/ class=md-nav__link> has_subtype </a> </li> <li class=md-nav__item> <a href=../api/byte_container_with_subtype/set_subtype/ class=md-nav__link> set_subtype </a> </li> <li class=md-nav__item> <a href=../api/byte_container_with_subtype/subtype/ class=md-nav__link> subtype </a> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle" data-md-toggle=__nav_4_3 type=checkbox id=__nav_4_3> <div class="md-nav__link md-nav__link--index "> <a href=../api/adl_serializer/ >adl_serializer</a> <label for=__nav_4_3> <span class="md-nav__icon md-icon"></span> </label> </div> <nav class=md-nav aria-label=adl_serializer data-md-level=2> <label class=md-nav__title for=__nav_4_3> <span class="md-nav__icon md-icon"></span> adl_serializer </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../api/adl_serializer/from_json/ class=md-nav__link> from_json </a> </li> <li class=md-nav__item> <a href=../api/adl_serializer/to_json/ class=md-nav__link> to_json </a> </li> </ul> </nav> </li> <li class=md-nav__item> <a href=../api/json/ class=md-nav__link> json </a> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle" data-md-toggle=__nav_4_5 type=checkbox id=__nav_4_5> <div class="md-nav__link md-nav__link--index "> <a href=../api/json_pointer/ >json_pointer</a> <label for=__nav_4_5> <span class="md-nav__icon md-icon"></span> </label> </div> <nav class=md-nav aria-label=json_pointer data-md-level=2> <label class=md-nav__title for=__nav_4_5> <span class="md-nav__icon md-icon"></span> json_pointer </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../api/json_pointer/json_pointer/ class=md-nav__link> (Constructor) </a> </li> <li class=md-nav__item> <a href=../api/json_pointer/back/ class=md-nav__link> back </a> </li> <li class=md-nav__item> <a href=../api/json_pointer/empty/ class=md-nav__link> empty </a> </li> <li class=md-nav__item> <a href=../api/json_pointer/operator_string_t/ class=md-nav__link> operator string_t </a> </li> <li class=md-nav__item> <a href=../api/json_pointer/operator_eq/ class=md-nav__link> operator== </a> </li> <li class=md-nav__item> <a href=../api/json_pointer/operator_ne/ class=md-nav__link> operator!= </a> </li> <li class=md-nav__item> <a href=../api/json_pointer/operator_slash/ class=md-nav__link> operator/ </a> </li> <li class=md-nav__item> <a href=../api/json_pointer/operator_slasheq/ class=md-nav__link> operator/= </a> </li> <li class=md-nav__item> <a href=../api/json_pointer/parent_pointer/ class=md-nav__link> parent_pointer </a> </li> <li class=md-nav__item> <a href=../api/json_pointer/pop_back/ class=md-nav__link> pop_back </a> </li> <li class=md-nav__item> <a href=../api/json_pointer/push_back/ class=md-nav__link> push_back </a> </li> <li class=md-nav__item> <a href=../api/json_pointer/string_t/ class=md-nav__link> string_t </a> </li> <li class=md-nav__item> <a href=../api/json_pointer/to_string/ class=md-nav__link> to_string </a> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle" data-md-toggle=__nav_4_6 type=checkbox id=__nav_4_6> <div class="md-nav__link md-nav__link--index "> <a href=../api/json_sax/ >json_sax</a> <label for=__nav_4_6> <span class="md-nav__icon md-icon"></span> </label> </div> <nav class=md-nav aria-label=json_sax data-md-level=2> <label class=md-nav__title for=__nav_4_6> <span class="md-nav__icon md-icon"></span> json_sax </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../api/json_sax/binary/ class=md-nav__link> binary </a> </li> <li class=md-nav__item> <a href=../api/json_sax/boolean/ class=md-nav__link> boolean </a> </li> <li class=md-nav__item> <a href=../api/json_sax/end_array/ class=md-nav__link> end_array </a> </li> <li class=md-nav__item> <a href=../api/json_sax/end_object/ class=md-nav__link> end_object </a> </li> <li class=md-nav__item> <a href=../api/json_sax/key/ class=md-nav__link> key </a> </li> <li class=md-nav__item> <a href=../api/json_sax/null/ class=md-nav__link> null </a> </li> <li class=md-nav__item> <a href=../api/json_sax/number_float/ class=md-nav__link> number_float </a> </li> <li class=md-nav__item> <a href=../api/json_sax/number_integer/ class=md-nav__link> number_integer </a> </li> <li class=md-nav__item> <a href=../api/json_sax/number_unsigned/ class=md-nav__link> number_unsigned </a> </li> <li class=md-nav__item> <a href=../api/json_sax/parse_error/ class=md-nav__link> parse_error </a> </li> <li class=md-nav__item> <a href=../api/json_sax/start_array/ class=md-nav__link> start_array </a> </li> <li class=md-nav__item> <a href=../api/json_sax/start_object/ class=md-nav__link> start_object </a> </li> <li class=md-nav__item> <a href=../api/json_sax/string/ class=md-nav__link> string </a> </li> </ul> </nav> </li> <li class=md-nav__item> <a href=../api/operator_ltlt/ class=md-nav__link> operator<<(basic_json) </a> </li> <li class=md-nav__item> <a href=../api/operator_ltlt/ class=md-nav__link> operator<<(json_pointer) </a> </li> <li class=md-nav__item> <a href=../api/operator_gtgt/ class=md-nav__link> operator>>(basic_json) </a> </li> <li class=md-nav__item> <a href=../api/operator_literal_json/ class=md-nav__link> operator""_json </a> </li> <li class=md-nav__item> <a href=../api/operator_literal_json_pointer/ class=md-nav__link> operator""_json_pointer </a> </li> <li class=md-nav__item> <a href=../api/ordered_json/ class=md-nav__link> ordered_json </a> </li> <li class=md-nav__item> <a href=../api/ordered_map/ class=md-nav__link> ordered_map </a> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle" data-md-toggle=__nav_4_14 type=checkbox id=__nav_4_14> <div class="md-nav__link md-nav__link--index "> <a href=../api/macros/ >macros</a> <label for=__nav_4_14> <span class="md-nav__icon md-icon"></span> </label> </div> <nav class=md-nav aria-label=macros data-md-level=2> <label class=md-nav__title for=__nav_4_14> <span class="md-nav__icon md-icon"></span> macros </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../api/macros/json_assert/ class=md-nav__link> JSON_ASSERT </a> </li> <li class=md-nav__item> <a href=../api/macros/json_throw_user/ class=md-nav__link> JSON_CATCH_USER </a> </li> <li class=md-nav__item> <a href=../api/macros/json_diagnostics/ class=md-nav__link> JSON_DIAGNOSTICS </a> </li> <li class=md-nav__item> <a href=../api/macros/json_disable_enum_serialization/ class=md-nav__link> JSON_DISABLE_ENUM_SERIALIZATION </a> </li> <li class=md-nav__item> <a href=../api/macros/json_has_cpp_11/ class=md-nav__link> JSON_HAS_CPP_11 </a> </li> <li class=md-nav__item> <a href=../api/macros/json_has_cpp_11/ class=md-nav__link> JSON_HAS_CPP_14 </a> </li> <li class=md-nav__item> <a href=../api/macros/json_has_cpp_11/ class=md-nav__link> JSON_HAS_CPP_17 </a> </li> <li class=md-nav__item> <a href=../api/macros/json_has_cpp_11/ class=md-nav__link> JSON_HAS_CPP_20 </a> </li> <li class=md-nav__item> <a href=../api/macros/json_has_filesystem/ class=md-nav__link> JSON_HAS_EXPERIMENTAL_FILESYSTEM </a> </li> <li class=md-nav__item> <a href=../api/macros/json_has_filesystem/ class=md-nav__link> JSON_HAS_FILESYSTEM </a> </li> <li class=md-nav__item> <a href=../api/macros/json_has_ranges/ class=md-nav__link> JSON_HAS_RANGES </a> </li> <li class=md-nav__item> <a href=../api/macros/json_has_three_way_comparison/ class=md-nav__link> JSON_HAS_THREE_WAY_COMPARISON </a> </li> <li class=md-nav__item> <a href=../api/macros/json_noexception/ class=md-nav__link> JSON_NOEXCEPTION </a> </li> <li class=md-nav__item> <a href=../api/macros/json_no_io/ class=md-nav__link> JSON_NO_IO </a> </li> <li class=md-nav__item> <a href=../api/macros/json_skip_library_version_check/ class=md-nav__link> JSON_SKIP_LIBRARY_VERSION_CHECK </a> </li> <li class=md-nav__item> <a href=../api/macros/json_skip_unsupported_compiler_check/ class=md-nav__link> JSON_SKIP_UNSUPPORTED_COMPILER_CHECK </a> </li> <li class=md-nav__item> <a href=../api/macros/json_throw_user/ class=md-nav__link> JSON_THROW_USER </a> </li> <li class=md-nav__item> <a href=../api/macros/json_throw_user/ class=md-nav__link> JSON_TRY_USER </a> </li> <li class=md-nav__item> <a href=../api/macros/json_use_global_udls/ class=md-nav__link> JSON_USE_GLOBAL_UDLS </a> </li> <li class=md-nav__item> <a href=../api/macros/json_use_implicit_conversions/ class=md-nav__link> JSON_USE_IMPLICIT_CONVERSIONS </a> </li> <li class=md-nav__item> <a href=../api/macros/json_use_legacy_discarded_value_comparison/ class=md-nav__link> JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON </a> </li> <li class=md-nav__item> <a href=../api/macros/nlohmann_define_type_intrusive/ class=md-nav__link> NLOHMANN_DEFINE_TYPE_INTRUSIVE </a> </li> <li class=md-nav__item> <a href=../api/macros/nlohmann_define_type_intrusive/ class=md-nav__link> NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT </a> </li> <li class=md-nav__item> <a href=../api/macros/nlohmann_define_type_non_intrusive/ class=md-nav__link> NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE </a> </li> <li class=md-nav__item> <a href=../api/macros/nlohmann_define_type_non_intrusive/ class=md-nav__link> NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT </a> </li> <li class=md-nav__item> <a href=../api/macros/nlohmann_json_namespace/ class=md-nav__link> NLOHMANN_JSON_NAMESPACE </a> </li> <li class=md-nav__item> <a href=../api/macros/nlohmann_json_namespace_begin/ class=md-nav__link> NLOHMANN_JSON_NAMESPACE_BEGIN </a> </li> <li class=md-nav__item> <a href=../api/macros/nlohmann_json_namespace_begin/ class=md-nav__link> NLOHMANN_JSON_NAMESPACE_END </a> </li> <li class=md-nav__item> <a href=../api/macros/nlohmann_json_namespace_no_version/ class=md-nav__link> NLOHMANN_JSON_NAMESPACE_NO_VERSION </a> </li> <li class=md-nav__item> <a href=../api/macros/nlohmann_json_serialize_enum/ class=md-nav__link> NLOHMANN_JSON_SERIALIZE_ENUM </a> </li> <li class=md-nav__item> <a href=../api/macros/nlohmann_json_version_major/ class=md-nav__link> NLOHMANN_JSON_VERSION_MAJOR </a> </li> <li class=md-nav__item> <a href=../api/macros/nlohmann_json_version_major/ class=md-nav__link> NLOHMANN_JSON_VERSION_MINOR </a> </li> <li class=md-nav__item> <a href=../api/macros/nlohmann_json_version_major/ class=md-nav__link> NLOHMANN_JSON_VERSION_PATCH </a> </li> </ul> </nav> </li> </ul> </nav> </li> </ul> </nav> </div> </div> </div> <div class="md-sidebar md-sidebar--secondary" data-md-component=sidebar data-md-type=toc> <div class=md-sidebar__scrollwrap> <div class=md-sidebar__inner> <nav class="md-nav md-nav--secondary" aria-label="Table of contents"> </nav> </div> </div> </div> <div class=md-content data-md-component=content> <article class="md-content__inner md-typeset"> <a href=https://github.com/nlohmann/json/edit/develop/docs/mkdocs/docs/integration/index.md title="Edit this page" class="md-content__button md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25Z"/></svg> </a> <h1 id=header-only>Header only<a class=headerlink href=#header-only title="Permanent link">¶</a></h1> <p><a href=https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json.hpp><code>json.hpp</code></a> is the single required file in <code>single_include/nlohmann</code> or <a href=https://github.com/nlohmann/json/releases>released here</a>. You need to add</p> <div class=highlight><pre><span></span><code><span class=cp>#include</span><span class=w> </span><span class=cpf><nlohmann/json.hpp></span><span class=cp></span>
|
|
|
|
<span class=c1>// for convenience</span>
|
|
<span class=k>using</span><span class=w> </span><span class=n>json</span><span class=w> </span><span class=o>=</span><span class=w> </span><span class=n>nlohmann</span><span class=o>::</span><span class=n>json</span><span class=p>;</span><span class=w></span>
|
|
</code></pre></div> <p>to the files you want to process JSON and set the necessary switches to enable C++11 (e.g., <code>-std=c++11</code> for GCC and Clang).</p> <p>You can further use file <a href=https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json_fwd.hpp><code>single_include/nlohmann/json_fwd.hpp</code></a> for forward declarations.</p> <hr> <div class=md-source-file> <small> Last update: <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">March 8, 2023</span> </small> </div> </article> </div> <script>var tabs=__md_get("__tabs");if(Array.isArray(tabs))e:for(var set of document.querySelectorAll(".tabbed-set")){var tab,labels=set.querySelector(".tabbed-labels");for(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> </div> <a href=# 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 8v12Z"/></svg> Back to top </a> </main> <footer class=md-footer> <nav class="md-footer__inner md-grid" aria-label=Footer> <a href=../features/types/number_handling/ class="md-footer__link md-footer__link--prev" aria-label="Previous: Number Handling" rel=prev> <div class="md-footer__button md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12Z"/></svg> </div> <div class=md-footer__title> <div class=md-ellipsis> <span class=md-footer__direction> Previous </span> Number Handling </div> </div> </a> <a href=migration_guide/ class="md-footer__link md-footer__link--next" aria-label="Next: Migration Guide" rel=next> <div class=md-footer__title> <div class=md-ellipsis> <span class=md-footer__direction> Next </span> Migration Guide </div> </div> <div class="md-footer__button md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4Z"/></svg> </div> </a> </nav> <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 © 2013 - 2022 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 496 512"><!-- Font Awesome Free 6.2.1 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 2022 Fonticons, Inc.--><path d="M165.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.6zm-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.3zm44.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.9zM244.8 8C106.1 8 0 113.3 0 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.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"/></svg> </a> <a href=https://twitter.com/nlohmann target=_blank rel=noopener title=twitter.com class=md-social__link> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 512 512"><!-- Font Awesome Free 6.2.1 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 2022 Fonticons, Inc.--><path d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"/></svg> </a> <a href=https://www.linkedin.com/in/nielslohmann/ target=_blank rel=noopener title=www.linkedin.com class=md-social__link> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 448 512"><!-- Font Awesome Free 6.2.1 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 2022 Fonticons, Inc.--><path d="M416 32H31.9C14.3 32 0 46.5 0 64.3v383.4C0 465.5 14.3 480 31.9 480H416c17.6 0 32-14.5 32-32.3V64.3c0-17.8-14.4-32.3-32-32.3zM135.4 416H69V202.2h66.5V416zm-33.2-243c-21.3 0-38.5-17.3-38.5-38.5S80.9 96 102.2 96c21.2 0 38.5 17.3 38.5 38.5 0 21.3-17.2 38.5-38.5 38.5zm282.1 243h-66.4V312c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9V416h-66.4V202.2h63.7v29.2h.9c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9V416z"/></svg> </a> <a href=https://www.xing.com/profile/Niels_Lohmann target=_blank rel=noopener title=www.xing.com class=md-social__link> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 384 512"><!-- Font Awesome Free 6.2.1 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 2022 Fonticons, Inc.--><path d="M162.7 210c-1.8 3.3-25.2 44.4-70.1 123.5-4.9 8.3-10.8 12.5-17.7 12.5H9.8c-7.7 0-12.1-7.5-8.5-14.4l69-121.3c.2 0 .2-.1 0-.3l-43.9-75.6c-4.3-7.8.3-14.1 8.5-14.1H100c7.3 0 13.3 4.1 18 12.2l44.7 77.5zM382.6 46.1l-144 253v.3L330.2 466c3.9 7.1.2 14.1-8.5 14.1h-65.2c-7.6 0-13.6-4-18-12.2l-92.4-168.5c3.3-5.8 51.5-90.8 144.8-255.2 4.6-8.1 10.4-12.2 17.5-12.2h65.7c8 0 12.3 6.7 8.5 14.1z"/></svg> </a> <a href=https://www.paypal.me/nlohmann target=_blank rel=noopener title=www.paypal.me class=md-social__link> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 384 512"><!-- Font Awesome Free 6.2.1 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 2022 Fonticons, Inc.--><path d="M111.4 295.9c-3.5 19.2-17.4 108.7-21.5 134-.3 1.8-1 2.5-3 2.5H12.3c-7.6 0-13.1-6.6-12.1-13.9L58.8 46.6c1.5-9.6 10.1-16.9 20-16.9 152.3 0 165.1-3.7 204 11.4 60.1 23.3 65.6 79.5 44 140.3-21.5 62.6-72.5 89.5-140.1 90.3-43.4.7-69.5-7-75.3 24.2zM357.1 152c-1.8-1.3-2.5-1.8-3 1.3-2 11.4-5.1 22.5-8.8 33.6-39.9 113.8-150.5 103.9-204.5 103.9-6.1 0-10.1 3.3-10.9 9.4-22.6 140.4-27.1 169.7-27.1 169.7-1 7.1 3.5 12.9 10.6 12.9h63.5c8.6 0 15.7-6.3 17.4-14.9.7-5.4-1.1 6.1 14.4-91.3 4.6-22 14.3-19.7 29.3-19.7 71 0 126.4-28.8 142.9-112.3 6.5-34.8 4.6-71.4-23.8-92.6z"/></svg> </a> </div> </div> </div> </footer> </div> <div class=md-dialog data-md-component=dialog> <div class="md-dialog__inner md-typeset"></div> </div> <script id=__config type=application/json>{"base": "..", "features": ["navigation.instant", "navigation.tracking", "navigation.tabs", "navigation.indexes", "navigation.top", "content.tabs.link"], "search": "../assets/javascripts/workers/search.16e2a7d4.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.placeholder": "Search", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version.title": "Select version"}}</script> <script src=../assets/javascripts/bundle.5a2dcb6a.min.js></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML"></script> </body> </html> |