mirror of
https://github.com/nlohmann/json.git
synced 2026-10-07 06:57:14 +00:00
deploy: e0f8cdfb7f
This commit is contained in:
1 parent
3d26d62a39
commit
9446cb8fa1
246 files changed
+631
-480
No files matched your search
@@ -225,7 +225,7 @@ cmake<span class=w> </span>--build<span class=w> </span>build
|
||||
</code></pre></div> </li> <li> <p>Build</p> <div class=highlight><pre><span></span><code>cmake<span class=w> </span>-S<span class=w> </span>.<span class=w> </span>-B<span class=w> </span>build<span class=w> </span>-DCMAKE_TOOLCHAIN_FILE<span class=o>=</span>cget/cget/cget.cmake
|
||||
cmake<span class=w> </span>--build<span class=w> </span>build
|
||||
</code></pre></div> </li> </ol> </details> <h2 id=swift-package-manager>Swift Package Manager<a class=headerlink href=#swift-package-manager title="Permanent link">¶</a></h2> <div class="admonition abstract"> <p class=admonition-title>Summary</p> <p>package: <strong><code>nlohmann/json</code></strong></p> <ul> <li><span class=twemoji><svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M7.75 6.5a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5"/><path d="M2.5 1h8.44a1.5 1.5 0 0 1 1.06.44l10.25 10.25a1.5 1.5 0 0 1 0 2.12l-8.44 8.44a1.5 1.5 0 0 1-2.12 0L1.44 12A1.5 1.5 0 0 1 1 10.94V2.5A1.5 1.5 0 0 1 2.5 1m0 1.5v8.44l10.25 10.25 8.44-8.44L10.94 2.5Z"/></svg></span> Available versions: current version and older versions</li> <li><span class=twemoji><svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M20.322.75h1.176a1.75 1.75 0 0 1 1.75 1.749v1.177a10.75 10.75 0 0 1-2.925 7.374l-1.228 1.304a24 24 0 0 1-1.596 1.542v5.038c0 .615-.323 1.184-.85 1.5l-4.514 2.709a.75.75 0 0 1-1.12-.488l-.963-4.572a1.3 1.3 0 0 1-.14-.129L8.04 15.96l-1.994-1.873a1.3 1.3 0 0 1-.129-.14l-4.571-.963a.75.75 0 0 1-.49-1.12l2.71-4.514c.316-.527.885-.85 1.5-.85h5.037a24 24 0 0 1 1.542-1.594l1.304-1.23A10.75 10.75 0 0 1 20.321.75Zm-6.344 4.018v-.001l-1.304 1.23a22.3 22.3 0 0 0-3.255 3.851l-2.193 3.29 1.859 1.744.034.034 1.743 1.858 3.288-2.192a22.3 22.3 0 0 0 3.854-3.257l1.228-1.303a9.25 9.25 0 0 0 2.517-6.346V2.5a.25.25 0 0 0-.25-.25h-1.177a9.25 9.25 0 0 0-6.344 2.518M6.5 21c-1.209 1.209-3.901 1.445-4.743 1.49a.24.24 0 0 1-.18-.067.24.24 0 0 1-.067-.18c.045-.842.281-3.534 1.49-4.743.9-.9 2.6-.9 3.5 0s.9 2.6 0 3.5m-.592-8.588L8.17 9.017q.346-.519.717-1.017H5.066a.25.25 0 0 0-.214.121l-2.167 3.612ZM16 15.112q-.5.372-1.018.718l-3.393 2.262.678 3.223 3.612-2.167a.25.25 0 0 0 .121-.214ZM17.5 8a1.5 1.5 0 1 1-3.001-.001A1.5 1.5 0 0 1 17.5 8"/></svg></span> The package is updated with every release.</li> <li><span class=twemoji><svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M3 3a2 2 0 0 1 2-2h9.982a2 2 0 0 1 1.414.586l4.018 4.018A2 2 0 0 1 21 7.018V21a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Zm2-.5a.5.5 0 0 0-.5.5v18a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5V8.5h-4a2 2 0 0 1-2-2v-4Zm10 0v4a.5.5 0 0 0 .5.5h4a.5.5 0 0 0-.146-.336l-4.018-4.018A.5.5 0 0 0 15 2.5"/></svg></span> File issues at the <a href="https://github.com/nlohmann/json/issues">library issue tracker</a></li> <li><span class=twemoji><svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M10.97 8.265a1.45 1.45 0 0 0-.487.57.75.75 0 0 1-1.341-.67c.2-.402.513-.826.997-1.148C10.627 6.69 11.244 6.5 12 6.5c.658 0 1.369.195 1.934.619a2.45 2.45 0 0 1 1.004 2.006c0 1.033-.513 1.72-1.027 2.215-.19.183-.399.358-.579.508l-.147.123a4 4 0 0 0-.435.409v1.37a.75.75 0 1 1-1.5 0v-1.473c0-.237.067-.504.247-.736.22-.28.486-.517.718-.714l.183-.153.001-.001c.172-.143.324-.27.47-.412.368-.355.569-.676.569-1.136a.95.95 0 0 0-.404-.806C12.766 8.118 12.384 8 12 8c-.494 0-.814.121-1.03.265M13 17a1 1 0 1 1-2 0 1 1 0 0 1 2 0"/><path d="M12 1c6.075 0 11 4.925 11 11s-4.925 11-11 11S1 18.075 1 12 5.925 1 12 1M2.5 12a9.5 9.5 0 0 0 9.5 9.5 9.5 9.5 0 0 0 9.5-9.5A9.5 9.5 0 0 0 12 2.5 9.5 9.5 0 0 0 2.5 12"/></svg></span> <a href="https://developer.apple.com/documentation/xcode/adding-package-dependencies-to-your-app">Xcode documentation</a></li> </ul> </div> <h2 id=nuget>NuGet<a class=headerlink href=#nuget title="Permanent link">¶</a></h2> <div class="admonition abstract"> <p class=admonition-title>Summary</p> <p>package: <a href="https://www.nuget.org/packages/nlohmann.json/"><strong><code>nlohmann.json</code></strong></a></p> <ul> <li><span class=twemoji><svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M7.75 6.5a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5"/><path d="M2.5 1h8.44a1.5 1.5 0 0 1 1.06.44l10.25 10.25a1.5 1.5 0 0 1 0 2.12l-8.44 8.44a1.5 1.5 0 0 1-2.12 0L1.44 12A1.5 1.5 0 0 1 1 10.94V2.5A1.5 1.5 0 0 1 2.5 1m0 1.5v8.44l10.25 10.25 8.44-8.44L10.94 2.5Z"/></svg></span> Available versions: current and previous versions</li> <li><span class=twemoji><svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M20.322.75h1.176a1.75 1.75 0 0 1 1.75 1.749v1.177a10.75 10.75 0 0 1-2.925 7.374l-1.228 1.304a24 24 0 0 1-1.596 1.542v5.038c0 .615-.323 1.184-.85 1.5l-4.514 2.709a.75.75 0 0 1-1.12-.488l-.963-4.572a1.3 1.3 0 0 1-.14-.129L8.04 15.96l-1.994-1.873a1.3 1.3 0 0 1-.129-.14l-4.571-.963a.75.75 0 0 1-.49-1.12l2.71-4.514c.316-.527.885-.85 1.5-.85h5.037a24 24 0 0 1 1.542-1.594l1.304-1.23A10.75 10.75 0 0 1 20.321.75Zm-6.344 4.018v-.001l-1.304 1.23a22.3 22.3 0 0 0-3.255 3.851l-2.193 3.29 1.859 1.744.034.034 1.743 1.858 3.288-2.192a22.3 22.3 0 0 0 3.854-3.257l1.228-1.303a9.25 9.25 0 0 0 2.517-6.346V2.5a.25.25 0 0 0-.25-.25h-1.177a9.25 9.25 0 0 0-6.344 2.518M6.5 21c-1.209 1.209-3.901 1.445-4.743 1.49a.24.24 0 0 1-.18-.067.24.24 0 0 1-.067-.18c.045-.842.281-3.534 1.49-4.743.9-.9 2.6-.9 3.5 0s.9 2.6 0 3.5m-.592-8.588L8.17 9.017q.346-.519.717-1.017H5.066a.25Line truncated
|
||||
</code></pre></div> <details class=example> <summary>Example</summary> <p>Probably the easiest way to use NuGet packages is through Visual Studio graphical interface. Just right-click on a project (any C++ project would do) in “Solution Explorer” and select “Manage NuGet Packages…”</p> <p><img alt src=../nuget/nuget-search-package.png></p> <p>Now you can click on “Browse” tab and find the package you like to install.</p> <p><img alt src=../nuget/nuget-select-package.png></p> <p>Most of the packages in NuGet gallery are .NET packages and would not be useful in a C++ project. Microsoft recommends adding “native” and “nativepackage” tags to C++ NuGet packages to distinguish them, but even adding “native” to search query would still show many .NET-only packages in the list.</p> <p>Nevertheless, after finding the package you want, click on “Install” button and accept confirmation dialogs. After the package is successfully added to the projects, you should be able to build and execute the project without the need for making any more changes to build settings.</p> <div class="admonition note"> <p class=admonition-title>Note</p> <p>A few notes:</p> <ul> <li>NuGet packages are installed per project and not system-wide. The header and binaries for the package are only available to the project it is added to, and not other projects (obviously unless we add the package to those projects as well)</li> <li>One of the many great things about your elegant work is that it is a header-only library, which makes deployment very straightforward. In case of libraries which need binary deployment (<code>.lib</code>, <code>.dll</code> and <code>.pdb</code> for debug info) the different binaries for each supported compiler version must be added to the NuGet package. Some library creators cram binary versions for all supported Visual C++ compiler versions in the same package, so a single package will support all compilers. Some others create a different package for each compiler version (and you usually see things like “v140” or “vc141” in package name to clarify which VC++ compiler this package supports).</li> <li>Packages can have dependency to other packages, and in this case, NuGet will install all dependencies as well as the requested package recursively.</li> </ul> </div> <p><strong>What happens behind the scenes</strong></p> <p>After you add a NuGet package, three changes occur in the project source directory. Of course, we could make these changes manually instead of using GUI:</p> <p><img alt src=../nuget/nuget-project-changes.png></p> <ol> <li> <p>A <code>packages.config</code> file will be created (or updated to include the package name if one such file already exists). This file contains a list of the packages required by this project (name and minimum version) and must be added to the project source code repository, so if you move the source code to a new machine, MSBuild/NuGet knows which packages it has to restore (which it does automatically before each build).</p> <div class=highlight><pre><span></span><code><span class=cp><?xml version="1.0" encoding="utf-8"?></span>
|
||||
</code></pre></div> <details class=example> <summary>Example</summary> <p>Probably the easiest way to use NuGet packages is through Visual Studio graphical interface. Right-click on a project (any C++ project would do) in “Solution Explorer” and select “Manage NuGet Packages…”</p> <p><img alt src=../nuget/nuget-search-package.png></p> <p>Now you can click on “Browse” tab and find the package you like to install.</p> <p><img alt src=../nuget/nuget-select-package.png></p> <p>Most of the packages in NuGet gallery are .NET packages and would not be useful in a C++ project. Microsoft recommends adding “native” and “nativepackage” tags to C++ NuGet packages to distinguish them, but even adding “native” to search query would still show many .NET-only packages in the list.</p> <p>Nevertheless, after finding the package you want, click on “Install” button and accept confirmation dialogs. After the package is successfully added to the projects, you should be able to build and execute the project without the need for making any more changes to build settings.</p> <div class="admonition note"> <p class=admonition-title>Note</p> <p>A few notes:</p> <ul> <li>NuGet packages are installed per project and not system-wide. The header and binaries for the package are only available to the project it is added to, and not other projects (obviously unless we add the package to those projects as well)</li> <li>One of the many great things about your elegant work is that it is a header-only library, which makes deployment very straightforward. In case of libraries which need binary deployment (<code>.lib</code>, <code>.dll</code> and <code>.pdb</code> for debug info) the different binaries for each supported compiler version must be added to the NuGet package. Some library creators cram binary versions for all supported Visual C++ compiler versions in the same package, so a single package will support all compilers. Some others create a different package for each compiler version (and you usually see things like “v140” or “vc141” in package name to clarify which VC++ compiler this package supports).</li> <li>Packages can have dependency to other packages, and in this case, NuGet will install all dependencies as well as the requested package recursively.</li> </ul> </div> <p><strong>What happens behind the scenes</strong></p> <p>After you add a NuGet package, three changes occur in the project source directory. Of course, we could make these changes manually instead of using GUI:</p> <p><img alt src=../nuget/nuget-project-changes.png></p> <ol> <li> <p>A <code>packages.config</code> file will be created (or updated to include the package name if one such file already exists). This file contains a list of the packages required by this project (name and minimum version) and must be added to the project source code repository, so if you move the source code to a new machine, MSBuild/NuGet knows which packages it has to restore (which it does automatically before each build).</p> <div class=highlight><pre><span></span><code><span class=cp><?xml version="1.0" encoding="utf-8"?></span>
|
||||
<span class=nt><packages></span>
|
||||
<span class=w> </span><span class=nt><package</span><span class=w> </span><span class=na>id=</span><span class=s>"nlohmann.json"</span><span class=w> </span><span class=na>version=</span><span class=s>"3.5.0"</span><span class=w> </span><span class=na>targetFramework=</span><span class=s>"native"</span><span class=w> </span><span class=nt>/></span>
|
||||
<span class=nt></packages></span>
|
||||
@@ -285,8 +285,94 @@ conda<span class=w> </span>activate<span class=w> </span>json
|
||||
</code></pre></div> </li> <li> <p>Install the package:</p> <div class=highlight><pre><span></span><code>sudo<span class=w> </span>port<span class=w> </span>install<span class=w> </span>nlohmann-json
|
||||
</code></pre></div> </li> <li> <p>Compile the code:</p> <div class=highlight><pre><span></span><code>cmake<span class=w> </span>-S<span class=w> </span>.<span class=w> </span>-B<span class=w> </span>build
|
||||
cmake<span class=w> </span>--build<span class=w> </span>build
|
||||
</code></pre></div> </li> </ol> </details> <h2 id=build2>build2<a class=headerlink href=#build2 title="Permanent link">¶</a></h2> <p>If you are using <a href="https://build2.org"><code>build2</code></a>, you can use the <a href="https://cppget.org/nlohmann-json"><code>nlohmann-json</code></a> package from the public repository <a href="http://cppget.org">http://cppget.org</a> or directly from the <a href="https://github.com/build2-packaging/nlohmann-json">package's sources repository</a>. In your project's <code>manifest</code> file, add <code>depends: nlohmann-json</code> (probably with some <a href="https://build2.org/build2-toolchain/doc/build2-toolchain-intro.xhtml#guide-add-remove-deps">version constraints</a>). If you are not familiar with using dependencies in <code>build2</code>, <a href="https://build2.org/build2-toolchain/doc/build2-toolchain-intro.xhtml">please read this introduction</a>. Please file issues <a href="https://github.com/build2-packaging/nlohmann-json">here</a> if you experience problems with the packages.</p> <p><span class=twemoji><svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M21 10.12h-6.78l2.74-2.82c-2.73-2.7-7.15-2.8-9.88-.1a6.887 6.887 0 0 0 0 9.8c2.73 2.7 7.15 2.7 9.88 0 1.36-1.35 2.04-2.92 2.04-4.9h2c0 1.98-.88 4.55-2.64 6.29-3.51 3.48-9.21 3.48-12.72 0-3.5-3.47-3.53-9.11-.02-12.58a8.987 8.987 0 0 1 12.65 0L21 3zM12.5 8v4.25l3.5 2.08-.72 1.21L11 13V8z"/></svg></span> The <a href="https://cppget.org/nlohmann-json">package</a> is updated automatically.</p> <div class=highlight><pre><span></span><code>bdep<span class=w> </span>new<span class=w> </span>-t<span class=w> </span>exe<span class=w> </span>-l<span class=w> </span>c++
|
||||
</code></pre></div> <h2 id=cpmcmake>CPM.cmake<a class=headerlink href=#cpmcmake title="Permanent link">¶</a></h2> <div class="admonition abstract"> <p class=admonition-title>Summary</p> <p>package: <strong><code>gh:nlohmann/json</code></strong></p> <ul> <li><span class=twemoji><svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M7.75 6.5a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5"/><path d="M2.5 1h8.44a1.5 1.5 0 0 1 1.06.44l10.25 10.25a1.5 1.5 0 0 1 0 2.12l-8.44 8.44a1.5 1.5 0 0 1-2.12 0L1.44 12A1.5 1.5 0 0 1 1 10.94V2.5A1.5 1.5 0 0 1 2.5 1m0 1.5v8.44l10.25 10.25 8.44-8.44L10.94 2.5Z"/></svg></span> Available versions: current and previous versions</li> <li><span class=twemoji><svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M20.322.75h1.176a1.75 1.75 0 0 1 1.75 1.749v1.177a10.75 10.75 0 0 1-2.925 7.374l-1.228 1.304a24 24 0 0 1-1.596 1.542v5.038c0 .615-.323 1.184-.85 1.5l-4.514 2.709a.75.75 0 0 1-1.12-.488l-.963-4.572a1.3 1.3 0 0 1-.14-.129L8.04 15.96l-1.994-1.873a1.3 1.3 0 0 1-.129-.14l-4.571-.963a.75.75 0 0 1-.49-1.12l2.71-4.514c.316-.527.885-.85 1.5-.85h5.037a24 24 0 0 1 1.542-1.594l1.304-1.23A10.75 10.75 0 0 1 20.321.75Zm-6.344 4.018v-.001l-1.304 1.23a22.3 22.3 0 0 0-3.255 3.851l-2.193 3.29 1.859 1.744.034.034 1.743 1.858 3.288-2.192a22.3 22.3 0 0 0 3.854-3.257l1.228-1.303a9.25 9.25 0 0 0 2.517-6.346V2.5a.25.25 0 0 0-.25-.25h-1.177a9.25 9.25 0 0 0-6.344 2.518M6.5 21c-1.209 1.209-3.901 1.445-4.743 1.49a.24.24 0 0 1-.18-.067.24.24 0 0 1-.067-.18c.045-.842.281-3.534 1.49-4.743.9-.9 2.6-.9 3.5 0s.9 2.6 0 3.5m-.592-8.588L8.17 9.017q.346-.519.717-1.017H5.066a.25.25 0 0 0-.214.121l-2.167 3.612ZM16 15.112q-.5.372-1.018.718l-3.393 2.262.678 3.223 3.612-2.167a.25.25 0 0 0 .121-.214ZM17.5 8a1.5 1.5 0 1 1-3.001-.001A1.5 1.5 0 0 1 17.5 8"/></svg></span> The package is updated with every release.</li> <li><span class=twemoji><svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M3 3a2 2 0 0 1 2-2h9.982a2 2 0 0 1 1.414.586l4.018 4.018A2 2 0 0 1 21 7.018V21a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Zm2-.5a.5.5 0 0 0-.5.5v18a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5V8.5h-4a2 2 0 0 1-2-2v-4Zm10 0v4a.5.5 0 0 0 .5.5h4a.5.5 0 0 0-.146-.336l-4.018-4.018A.5.5 0 0 0 15 2.5"/></svg></span> File issues at the <a href="https://github.com/cpm-cmake/CPM.cmake/issues">CPM.cmake issue tracker</a></li> <li><span class=twemoji><svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M10.97 8.265a1.45 1.45 0 0 0-.487.57.75.75 0 0 1-1.341-.67c.2-.402.513-.826.997-1.148C10.627 6.69 11.244 6.5 12 6.5c.658 0 1.369.195 1.934.619a2.45 2.45 0 0 1 1.004 2.006c0 1.033-.513 1.72-1.027 2.215-.19.183-.399.358-.579.508l-.147.123a4 4 0 0 0-.435.409v1.37a.75.75 0 1 1-1.5 0v-1.473c0-.237.067-.504.247-.736.22-.28.486-.517.718-.714l.183-.153.001-.001c.172-.143.324-.27.47-.412.368-.355.569-.676.569-1.136a.95.95 0 0 0-.404-.806C12.766 8.118 12.384 8 12 8c-.494 0-.814.121-1.03.265M13 17a1 1 0 1 1-2 0 1 1 0 0 1 2 0"/><path d="M12 1c6.075 0 11 4.925 11 11s-4.925 11-11 11S1 18.075 1 12 5.925 1 12 1M2.5 12a9.5 9.5 0 0 0 9.5 9.5 9.5 9.5 0 0 0 9.5-9.5A9.5 9.5 0 0 0 12 2.5 9.5 9.5 0 0 0 2.5 12"/></svg></span> <a href="https://github.com/cpm-cmake/CPM.cmake">CPM.cmake website</a></li> </ul> </div> <p>If you are using <a href="https://github.com/TheLartians/CPM.cmake"><code>CPM.cmake</code></a>, add the <a href="https://github.com/TheLartians/CPM.cmake#adding-cpm">CPM.cmake script</a> and the following snippet to your CMake project:</p> <div class=highlight><pre><span></span><code><span class=nb>CPMAddPackage</span><span class=p>(</span><span class=s2>"gh:nlohmann/json@3.12.0"</span><span class=p>)</span>
|
||||
</code></pre></div> </li> </ol> </details> <h2 id=build2>build2<a class=headerlink href=#build2 title="Permanent link">¶</a></h2> <div class="admonition abstract"> <p class=admonition-title>Summary</p> <p>package: <strong><code>nlohmann-json</code></strong> library target: <strong><code>nlohmann-json%lib{json}</code></strong> available in package repositories: - <a href="https://cppget.org/nlohmann-json"><code>cppget.org</code> (recommended)</a> - <a href="https://github.com/build2-packaging/nlohmann-json/">package's sources (for advanced users)</a></p> <ul> <li><span class=twemoji><svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M7.75 6.5a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5"/><path d="M2.5 1h8.44a1.5 1.5 0 0 1 1.06.44l10.25 10.25a1.5 1.5 0 0 1 0 2.12l-8.44 8.44a1.5 1.5 0 0 1-2.12 0L1.44 12A1.5 1.5 0 0 1 1 10.94V2.5A1.5 1.5 0 0 1 2.5 1m0 1.5v8.44l10.25 10.25 8.44-8.44L10.94 2.5Z"/></svg></span> Available versions: current version and older versions since <code>3.7.3</code> (see <a href="https://cppget.org/nlohmann-json">cppget.org</a>)</li> <li><span class=twemoji><svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M20.322.75h1.176a1.75 1.75 0 0 1 1.75 1.749v1.177a10.75 10.75 0 0 1-2.925 7.374l-1.228 1.304a24 24 0 0 1-1.596 1.542v5.038c0 .615-.323 1.184-.85 1.5l-4.514 2.709a.75.75 0 0 1-1.12-.488l-.963-4.572a1.3 1.3 0 0 1-.14-.129L8.04 15.96l-1.994-1.873a1.3 1.3 0 0 1-.129-.14l-4.571-.963a.75.75 0 0 1-.49-1.12l2.71-4.514c.316-.527.885-.85 1.5-.85h5.037a24 24 0 0 1 1.542-1.594l1.304-1.23A10.75 10.75 0 0 1 20.321.75Zm-6.344 4.018v-.001l-1.304 1.23a22.3 22.3 0 0 0-3.255 3.851l-2.193 3.29 1.859 1.744.034.034 1.743 1.858 3.288-2.192a22.3 22.3 0 0 0 3.854-3.257l1.228-1.303a9.25 9.25 0 0 0 2.517-6.346V2.5a.25.25 0 0 0-.25-.25h-1.177a9.25 9.25 0 0 0-6.344 2.518M6.5 21c-1.209 1.209-3.901 1.445-4.743 1.49a.24.24 0 0 1-.18-.067.24.24 0 0 1-.067-.18c.045-.842.281-3.534 1.49-4.743.9-.9 2.6-.9 3.5 0s.9 2.6 0 3.5m-.592-8.588L8.17 9.017q.346-.519.717-1.017H5.066a.25.25 0 0 0-.214.121l-2.167 3.612ZM16 15.112q-.5.372-1.018.718l-3.393 2.262.678 3.223 3.612-2.167a.25.25 0 0 0 .121-.214ZM17.5 8a1.5 1.5 0 1 1-3.001-.001A1.5 1.5 0 0 1 17.5 8"/></svg></span> The package is maintained and published by the <code>build2</code> community in [this repository]<a href="https://github.com/build2-packaging/nlohmann-json/">(https://github.com/build2-packaging/nlohmann-json/</a>).</li> <li><span class=twemoji><svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M3 3a2 2 0 0 1 2-2h9.982a2 2 0 0 1 1.414.586l4.018 4.018A2 2 0 0 1 21 7.018V21a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Zm2-.5a.5.5 0 0 0-.5.5v18a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5V8.5h-4a2 2 0 0 1-2-2v-4Zm10 0v4a.5.5 0 0 0 .5.5h4a.5.5 0 0 0-.146-.336l-4.018-4.018A.5.5 0 0 0 15 2.5"/></svg></span> File issues at the <a href="https://github.com/build2-packaging/nlohmann-json/issues/">package source repository</a></li> <li><span class=twemoji><svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M10.97 8.265a1.45 1.45 0 0 0-.487.57.75.75 0 0 1-1.341-.67c.2-.402.513-.826.997-1.148C10.627 6.69 11.244 6.5 12 6.5c.658 0 1.369.195 1.934.619a2.45 2.45 0 0 1 1.004 2.006c0 1.033-.513 1.72-1.027 2.215-.19.183-.399.358-.579.508l-.147.123a4 4 0 0 0-.435.409v1.37a.75.75 0 1 1-1.5 0v-1.473c0-.237.067-.504.247-.736.22-.28.486-.517.718-.714l.183-.153.001-.001c.172-.143.324-.27.47-.412.368-.355.569-.676.569-1.136a.95.95 0 0 0-.404-.806C12.766 8.118 12.384 8 12 8c-.494 0-.814.121-1.03.265M13 17a1 1 0 1 1-2 0 1 1 0 0 1 2 0"/><path d="M12 1c6.075 0 11 4.925 11 11s-4.925 11-11 11S1 18.075 1 12 5.925 1 12 1M2.5 12a9.5 9.5 0 0 0 9.5 9.5 9.5 9.5 0 0 0 9.5-9.5A9.5 9.5 0 0 0 12 2.5 9.5 9.5 0 0 0 2.5 12"/></svg></span> <a href="https://build2"><code>build2</code> website</a></li> </ul> </div> <p>Note: <a href="https://build2.org"><code>build2</code></a> should not be considered as a standalone package-manager. It is a build-system + package manager + project manager, a set of tools that work hand-in-hand. <code>build2</code>-based projects do not rely on existing <code>CMake</code> scripts and the build scripts defining the project's targets are specific to <code>build2</code>.</p> <p>To use this package in an exising <a href="https://build2.org"><code>build2</code></a> project, the general steps are:</p> <ol> <li> <p><details><summary>Make the package available to download from a package repository that provides it.</summary></p> <p>Your project's <code>repositories.manifest</code> specifies where the package manager will try to acquire packages by default. Make sure one of the repositories specified in this file provides <code>nlhomann-json</code> package. The recommended open-source repository is <a href="https://cppget.org/"><code>cppget.org</code></a>.</p> <p>If the project has been created using <a href="https://build2.org/bdep/doc/bdep-new.xhtml"><code>bdep new</code></a>, <code>cppget.org</code> is already specified in <code>repositories.maniLine truncated
|
||||
role: prerequisite
|
||||
location: https://pkg.cppget.org/1/stable
|
||||
</code></pre></div> </details></p> </li> <li> <p><details><summary>Add this package as dependency of your project.</summary></p> <p>In your project's <code>manifest</code> add the dependency to the package using <code>depends: nlohmann-json</code>. You could also add some <a href="https://build2.org/build2-toolchain/doc/build2-toolchain-intro.xhtml#guide-add-remove-deps">version constraints</a>. For example, to depend on the latest version available: <div class=highlight><pre><span></span><code>depends: nlohmann-json
|
||||
</code></pre></div> </details></p> </li> <li> <p><details><summary>Add this library as dependency of your target that uses it.</summary></p> <p>In the <code>buildfile</code> defining the target that will use this library:</p> <div class=codehilite><pre><span></span><code>- import the target `lib{json}` from the `nlhomann-json` package, for example:
|
||||
```
|
||||
import nljson = nlhomann-json%lib{json}
|
||||
```
|
||||
|
||||
- then add the library's target as requirement for your target using it, for example:
|
||||
```
|
||||
exe{example} : ... $nljson
|
||||
```
|
||||
</code></pre></div> </details> </li> <li> <p><details><summary>Use the library in your project's code and build it.</summary></p> <p>At this point, assuming your project is initialized in a build-configuration, any <code>b</code> or <code>bdep update</code> command that will update/build the project will also acquire the missing dependency automatically, then build it and link it with your target.</p> <p>If you just want to synchronize dependencies for all your configurations to download the ones you just added: <div class=highlight><pre><span></span><code>bdep sync -af
|
||||
</code></pre></div> </details></p> </li> </ol> <details class=example> <summary>Example: from scratch, using <code>build2</code>'s <a href="https://build2.org/bdep/doc/bdep-new.xhtml"><code>bdep new</code> command</a></summary> <ol> <li> <p>Create a new executable project "example" (see <a href="https://build2.org/bdep/doc/bdep-new.xhtml"><code>bdep new</code> command details</a> for the various options to create a new project):</p> <div class=highlight><pre><span></span><code>bdep<span class=w> </span>new<span class=w> </span>example
|
||||
</code></pre></div> </li> <li> <p>Edit these files by replacing their content:</p> <ul> <li> <p><code>example/repositories.manifest</code>: Enable acquiring packages from <a href="https://cppget.org">https://cppget.org</a> by uncommenting the related lines:</p> <div class=highlight><span class=filename>project's `repositories.manifest`</span><pre><span></span><code><span class=cp>: 1</span>
|
||||
<span class=nf>summary</span><span class=o>:</span><span class=w> </span><span class=n>example</span> <span class=n>project</span> <span class=n>repository</span>
|
||||
|
||||
<span class=cp>:</span>
|
||||
<span class=nf>role</span><span class=o>:</span><span class=w> </span><span class=n>prerequisite</span>
|
||||
<span class=nf>location</span><span class=o>:</span><span class=w> </span><span class=n>https</span>://<span class=n>pkg</span>.<span class=n>cppget</span>.<span class=n>org</span>/1/<span class=n>stable</span>
|
||||
<span class=c>#trust: ...</span>
|
||||
|
||||
<span class=c>#:</span>
|
||||
<span class=c>#role: prerequisite</span>
|
||||
<span class=c>#location: https://git.build2.org/hello/libhello.git</span>
|
||||
</code></pre></div> </li> <li> <p><code>example/manifest</code>: Add the latest version of the <code>nlohmann-json</code> package as dependency to the project:</p> <div class=highlight><span class=filename>project's `manifest`</span><pre><span></span><code><span class=nf>name</span><span class=o>:</span><span class=w> </span><span class=n>example</span>
|
||||
<span class=nf>version</span><span class=o>:</span><span class=w> </span>0.1.0-<span class=n>a</span>.0.<span class=n>z</span>
|
||||
<span class=nf>language</span><span class=o>:</span><span class=w> </span><span class=n>c</span>++
|
||||
<span class=nf>summary</span><span class=o>:</span><span class=w> </span><span class=n>example</span> <span class=n>C</span>++ <span class=n>executable</span>
|
||||
<span class=nf>license</span><span class=o>:</span><span class=w> </span><span class=n>other</span>: <span class=n>proprietary</span> ; <span class=n>Not</span> <span class=n>free</span>/<span class=n>open</span> <span class=n>source</span>.
|
||||
<span class=nf>description-file</span><span class=o>:</span><span class=w> </span><span class=n>README</span>.<span class=n>md</span>
|
||||
<span class=nf>url</span><span class=o>:</span><span class=w> </span><span class=n>https</span>://<span class=n>example</span>.<span class=n>org</span>/<span class=n>example</span>
|
||||
<span class=nf>email</span><span class=o>:</span><span class=w> </span><span class=n>your</span>@<span class=n>emailprovider</span>.<span class=n>com</span>
|
||||
<span class=c>#build-error-email: your@emailprovider.com</span>
|
||||
<span class=nf>depends</span><span class=o>:</span><span class=w> </span>* <span class=n>build</span>2 >= 0.16.0
|
||||
<span class=nf>depends</span><span class=o>:</span><span class=w> </span>* <span class=n>bpkg</span> >= 0.16.0
|
||||
<span class=c>#depends: libhello ^1.0.0</span>
|
||||
|
||||
<span class=nf>depends</span><span class=o>:</span><span class=w> </span><span class=n>nlohmann</span>-<span class=n>json</span>
|
||||
</code></pre></div> </li> <li> <p><code>example/example/buildfile</code>: import the library's target to be used as requirement for building the executable target <code>exe{example}</code>:</p> <div class=highlight><span class=filename>project's `buildfile`</span><pre><span></span><code><span class=nv>libs</span><span class=w> </span><span class=o>=</span>
|
||||
<span class=err>import</span><span class=w> </span><span class=nv>libs</span><span class=w> </span><span class=o>=</span><span class=w> </span>nlohmann-json%lib<span class=o>{</span>json<span class=o>}</span>
|
||||
|
||||
<span class=nf>exe{example}</span><span class=o>:</span><span class=w> </span>{<span class=n>hxx</span> <span class=n>ixx</span> <span class=n>txx</span> <span class=n>cxx</span>}{**} $<span class=n>libs</span> <span class=n>testscript</span>
|
||||
|
||||
<span class=nv>cxx.poptions</span><span class=w> </span><span class=o>=</span>+<span class=w> </span><span class=s2>"-I</span><span class=nv>$out_root</span><span class=s2>"</span><span class=w> </span><span class=s2>"-I</span><span class=nv>$src_root</span><span class=s2>"</span>
|
||||
</code></pre></div> </li> <li> <p><code>example/example/example.cxx</code>: <code>bdep new</code> generates a "hello world" by default, replace it by this:</p> <div class=highlight><span class=filename>example.cxx</span><pre><span></span><code><span class=cp>#include</span><span class=w> </span><span class=cpf><nlohmann/json.hpp></span>
|
||||
<span class=cp>#include</span><span class=w> </span><span class=cpf><iostream></span>
|
||||
<span class=cp>#include</span><span class=w> </span><span class=cpf><iomanip></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=kt>int</span><span class=w> </span><span class=nf>main</span><span class=p>()</span>
|
||||
<span class=p>{</span>
|
||||
<span class=w> </span><span class=n>std</span><span class=o>::</span><span class=n>cout</span><span class=w> </span><span class=o><<</span><span class=w> </span><span class=n>std</span><span class=o>::</span><span class=n>setw</span><span class=p>(</span><span class=mi>4</span><span class=p>)</span><span class=w> </span><span class=o><<</span><span class=w> </span><span class=n>json</span><span class=o>::</span><span class=n>meta</span><span class=p>()</span><span class=w> </span><span class=o><<</span><span class=w> </span><span class=n>std</span><span class=o>::</span><span class=n>endl</span><span class=p>;</span>
|
||||
<span class=p>}</span>
|
||||
</code></pre></div> </li> <li> <p><code>example/example/testscript</code>: (optional) if you want to be able to test that executable's output is correct using <code>b test</code>:</p> <div class=highlight><span class=filename>`testscript` checking the output of the program</span><pre><span></span><code><span class=o>:</span><span class=w> </span><span class=n>json</span><span class=w> </span><span class=n>basics</span>
|
||||
<span class=o>:</span>
|
||||
<span class=n>$</span><span class=o>*</span><span class=w> </span><span class=o>>>~/</span><span class=n>EOO</span><span class=o>/</span>
|
||||
<span class=p>{</span>
|
||||
<span class=w> </span><span class=s>"compiler"</span><span class=o>:</span><span class=w> </span><span class=p>{</span>
|
||||
<span class=o>/</span><span class=w> </span><span class=s>"c\+\+"</span><span class=o>:</span><span class=w> </span><span class=s>"\d+"</span><span class=p>,</span><span class=o>/</span>
|
||||
<span class=o>/</span><span class=w> </span><span class=s>"family"</span><span class=o>:</span><span class=w> </span><span class=s>"[\w\d]+"</span><span class=p>,</span><span class=o>/</span>
|
||||
<span class=o>/</span><span class=w> </span><span class=s>"version"</span><span class=o>:</span><span class=w> </span><span class=err>\</span><span class=n>d</span><span class=o>+/</span>
|
||||
<span class=w> </span><span class=p>},</span>
|
||||
<span class=o>/</span><span class=w> </span><span class=s>"copyright"</span><span class=o>:</span><span class=w> </span><span class=s>"\(C\) 2013-\d+ Niels Lohmann"</span><span class=p>,</span><span class=o>/</span>
|
||||
<span class=w> </span><span class=s>"name"</span><span class=o>:</span><span class=w> </span><span class=s>"JSON for Modern C++"</span><span class=p>,</span>
|
||||
<span class=o>/</span><span class=w> </span><span class=s>"platform"</span><span class=o>:</span><span class=w> </span><span class=s>"[\w\d]+"</span><span class=p>,</span><span class=o>/</span>
|
||||
<span class=w> </span><span class=s>"url"</span><span class=o>:</span><span class=w> </span><span class=s>"https://github.com/nlohmann/json"</span><span class=p>,</span>
|
||||
<span class=w> </span><span class=s>"version"</span><span class=o>:</span><span class=w> </span><span class=p>{</span>
|
||||
<span class=w> </span><span class=s>"major"</span><span class=o>:</span><span class=w> </span><span class=mi>3</span><span class=p>,</span>
|
||||
<span class=o>/</span><span class=w> </span><span class=s>"minor"</span><span class=o>:</span><span class=w> </span><span class=err>\</span><span class=n>d</span><span class=o>+</span><span class=p>,</span><span class=o>/</span>
|
||||
<span class=o>/</span><span class=w> </span><span class=s>"patch"</span><span class=o>:</span><span class=w> </span><span class=err>\</span><span class=n>d</span><span class=o>+</span><span class=p>,</span><span class=o>/</span>
|
||||
<span class=o>/</span><span class=w> </span><span class=s>"string"</span><span class=o>:</span><span class=w> </span><span class=s>"3\.\d+\.\d+"</span><span class=o>/</span>
|
||||
<span class=w> </span><span class=p>}</span>
|
||||
<span class=p>}</span>
|
||||
<span class=n>EOO</span>
|
||||
</code></pre></div> </li> </ul> </li> <li> <p>Initialize the project in a default C/C++ build configuration directory, then build and test:</p> <div class=highlight><pre><span></span><code><span class=nb>cd</span><span class=w> </span>example/
|
||||
|
||||
<span class=c1># create default C/C++ build configuration in ../example-myconfig/, initialize the project in it (downloads it's dependencies in it too)</span>
|
||||
bdep<span class=w> </span>init<span class=w> </span>-C<span class=w> </span>@myconfig<span class=w> </span>cc
|
||||
|
||||
<span class=c1># build only,</span>
|
||||
b
|
||||
|
||||
<span class=c1># or build and test the executable's output, will only work if the `tescript` is correct</span>
|
||||
b<span class=w> </span><span class=nb>test</span>
|
||||
</code></pre></div> </li> </ol> </details> <h2 id=cpmcmake>CPM.cmake<a class=headerlink href=#cpmcmake title="Permanent link">¶</a></h2> <div class="admonition abstract"> <p class=admonition-title>Summary</p> <p>package: <strong><code>gh:nlohmann/json</code></strong></p> <ul> <li><span class=twemoji><svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M7.75 6.5a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5"/><path d="M2.5 1h8.44a1.5 1.5 0 0 1 1.06.44l10.25 10.25a1.5 1.5 0 0 1 0 2.12l-8.44 8.44a1.5 1.5 0 0 1-2.12 0L1.44 12A1.5 1.5 0 0 1 1 10.94V2.5A1.5 1.5 0 0 1 2.5 1m0 1.5v8.44l10.25 10.25 8.44-8.44L10.94 2.5Z"/></svg></span> Available versions: current and previous versions</li> <li><span class=twemoji><svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M20.322.75h1.176a1.75 1.75 0 0 1 1.75 1.749v1.177a10.75 10.75 0 0 1-2.925 7.374l-1.228 1.304a24 24 0 0 1-1.596 1.542v5.038c0 .615-.323 1.184-.85 1.5l-4.514 2.709a.75.75 0 0 1-1.12-.488l-.963-4.572a1.3 1.3 0 0 1-.14-.129L8.04 15.96l-1.994-1.873a1.3 1.3 0 0 1-.129-.14l-4.571-.963a.75.75 0 0 1-.49-1.12l2.71-4.514c.316-.527.885-.85 1.5-.85h5.037a24 24 0 0 1 1.542-1.594l1.304-1.23A10.75 10.75 0 0 1 20.321.75Zm-6.344 4.018v-.001l-1.304 1.23a22.3 22.3 0 0 0-3.255 3.851l-2.193 3.29 1.859 1.744.034.034 1.743 1.858 3.288-2.192a22.3 22.3 0 0 0 3.854-3.257l1.228-1.303a9.25 9.25 0 0 0 2.517-6.346V2.5a.25.25 0 0 0-.25-.25h-1.177a9.25 9.25 0 0 0-6.344 2.518M6.5 21c-1.209 1.209-3.901 1.445-4.743 1.49a.24.24 0 0 1-.18-.067.24.24 0 0 1-.067-.18c.045-.842.281-3.534 1.49-4.743.9-.9 2.6-.9 3.5 0s.9 2.6 0 3.5m-.592-8.588L8.17 9.017q.346-.519.717-1.017H5.066a.25.25 0 0 0-.214.121l-2.167 3.612ZM16 15.112q-.5.372-1.018.718l-3.393 2.262.678 3.223 3.612-2.167a.25.25 0 0 0 .121-.214ZM17.5 8a1.5 1.5 0 1 1-3.001-.001A1.5 1.5 0 0 1 17.5 8"/></svg></span> The package is updated with every release.</li> <li><span class=twemoji><svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M3 3a2 2 0 0 1 2-2h9.982a2 2 0 0 1 1.414.586l4.018 4.018A2 2 0 0 1 21 7.018V21a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Zm2-.5a.5.5 0 0 0-.5.5v18a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5V8.5h-4a2 2 0 0 1-2-2v-4Zm10 0v4a.5.5 0 0 0 .5.5h4a.5.5 0 0 0-.146-.336l-4.018-4.018A.5.5 0 0 0 15 2.5"/></svg></span> File issues at the <a href="https://github.com/cpm-cmake/CPM.cmake/issues">CPM.cmake issue tracker</a></li> <li><span class=twemoji><svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M10.97 8.265a1.45 1.45 0 0 0-.487.57.75.75 0 0 1-1.341-.67c.2-.402.513-.826.997-1.148C10.627 6.69 11.244 6.5 12 6.5c.658 0 1.369.195 1.934.619a2.45 2.45 0 0 1 1.004 2.006c0 1.033-.513 1.72-1.027 2.215-.19.183-.399.358-.579.508l-.147.123a4 4 0 0 0-.435.409v1.37a.75.75 0 1 1-1.5 0v-1.473c0-.237.067-.504.247-.736.22-.28.486-.517.718-.714l.183-.153.001-.001c.172-.143.324-.27.47-.412.368-.355.569-.676.569-1.136a.95.95 0 0 0-.404-.806C12.766 8.118 12.384 8 12 8c-.494 0-.814.121-1.03.265M13 17a1 1 0 1 1-2 0 1 1 0 0 1 2 0"/><path d="M12 1c6.075 0 11 4.925 11 11s-4.925 11-11 11S1 18.075 1 12 5.925 1 12 1M2.5 12a9.5 9.5 0 0 0 9.5 9.5 9.5 9.5 0 0 0 9.5-9.5A9.5 9.5 0 0 0 12 2.5 9.5 9.5 0 0 0 2.5 12"/></svg></span> <a href="https://github.com/cpm-cmake/CPM.cmake">CPM.cmake website</a></li> </ul> </div> <p>If you are using <a href="https://github.com/TheLartians/CPM.cmake"><code>CPM.cmake</code></a>, add the <a href="https://github.com/TheLartians/CPM.cmake#adding-cpm">CPM.cmake script</a> and the following snippet to your CMake project:</p> <div class=highlight><pre><span></span><code><span class=nb>CPMAddPackage</span><span class=p>(</span><span class=s2>"gh:nlohmann/json@3.12.0"</span><span class=p>)</span>
|
||||
</code></pre></div> <details class=example> <summary>Example</summary> <ol> <li> <p>Create the following files:</p> <div class=highlight><span class=filename>example.cpp</span><pre><span></span><code><span class=cp>#include</span><span class=w> </span><span class=cpf><nlohmann/json.hpp></span>
|
||||
<span class=cp>#include</span><span class=w> </span><span class=cpf><iostream></span>
|
||||
<span class=cp>#include</span><span class=w> </span><span class=cpf><iomanip></span>
|
||||
@@ -330,4 +416,4 @@ cmake<span class=w> </span>--build<span class=w> </span>build
|
||||
<span class=w> </span><span class=nf>set_languages</span><span class=p>(</span><span class=s2>"cxx11"</span><span class=p>)</span>
|
||||
</code></pre></div> </li> <li> <p>Build</p> <div class=highlight><pre><span></span><code>xmake
|
||||
</code></pre></div> </li> <li> <p>Run</p> <div class=highlight><pre><span></span><code>xmake<span class=w> </span>run
|
||||
</code></pre></div> </li> </ol> </details> <hr> <h2 id=other-package-managers>Other package managers<a class=headerlink href=#other-package-managers title="Permanent link">¶</a></h2> <p>The library is also contained in many other package repositories: <a href="https://repology.org/project/nlohmann-json/versions"><img alt="Packaging status" src="../../assets/external/repology.org/badge/tiny-repos/nlohmann-json.svg"></a></p> <details class=example> <summary>Package version overview</summary> <p><a href="https://repology.org/project/nlohmann-json/versions"><img alt="Packaging status" src="../../assets/external/repology.org/badge/vertical-allrepos/nlohmann-json.svg"></a></p> </details> <hr> <h2 id=buckaroo>Buckaroo<a class=headerlink href=#buckaroo title="Permanent link">¶</a></h2> <p>If you are using <a href="https://buckaroo.pm">Buckaroo</a>, you can install this library's module with <code>buckaroo add github.com/buckaroo-pm/nlohmann-json</code>. There is a demo repo <a href="https://github.com/njlr/buckaroo-nholmann-json-example">here</a>.</p> <div class="admonition warning"> <p class=admonition-title>Warning</p> <p>The module is outdated as the respective <a href="https://github.com/buckaroo-pm/nlohmann-json">repository</a> has not been updated in years.</p> </div> <h2 id=cocoapods>CocoaPods<a class=headerlink href=#cocoapods title="Permanent link">¶</a></h2> <p>If you are using <a href="https://cocoapods.org">CocoaPods</a>, you can use the library by adding pod <code>"nlohmann_json", '~>3.1.2'</code> to your podfile (see <a href="https://bitbucket.org/benman/nlohmann_json-cocoapod/src/master/">an example</a>). Please file issues <a href="https://bitbucket.org/benman/nlohmann_json-cocoapod/issues?status=new&status=open">here</a>.</p> <p><img alt src="../../assets/external/img.shields.io/cocoapods/v/nlohmann_json.svg"></p> <div class="admonition warning"> <p class=admonition-title>Warning</p> <p>The module is outdated as the respective <a href="https://cocoapods.org/pods/nlohmann_json">pod</a> has not been updated in years.</p> </div> <!-- 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="May 8, 2026 06:20:24 UTC">May 8, 2026</span> </span> </aside> </article> </div> <script>var tabs=__md_get("__tabs");if(Array.isArray(tabs))e:for(var set of document.querySelectorAll(".tabbed-set")){var labels=set.querySelector(".tabbed-labels");for(var 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> <script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script> </div> <button type=button 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 8z"/></svg> Back to top </button> </main> <footer class=md-footer> <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-2026 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 512 512"><!-- Font Awesome Free 7.1.0 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 2025 Fonticons, Inc.--><path d="M173.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.6m-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.3m44.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.9M252.8 8C114.1 8 8 113.3 8 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 Line truncated
|
||||
</code></pre></div> </li> </ol> </details> <hr> <h2 id=other-package-managers>Other package managers<a class=headerlink href=#other-package-managers title="Permanent link">¶</a></h2> <p>The library is also contained in many other package repositories: <a href="https://repology.org/project/nlohmann-json/versions"><img alt="Packaging status" src="../../assets/external/repology.org/badge/tiny-repos/nlohmann-json.svg"></a></p> <details class=example> <summary>Package version overview</summary> <p><a href="https://repology.org/project/nlohmann-json/versions"><img alt="Packaging status" src="../../assets/external/repology.org/badge/vertical-allrepos/nlohmann-json.svg"></a></p> </details> <hr> <h2 id=buckaroo>Buckaroo<a class=headerlink href=#buckaroo title="Permanent link">¶</a></h2> <p>If you are using <a href="https://buckaroo.pm">Buckaroo</a>, you can install this library's module with <code>buckaroo add github.com/buckaroo-pm/nlohmann-json</code>. There is a demo repo <a href="https://github.com/njlr/buckaroo-nholmann-json-example">here</a>.</p> <div class="admonition warning"> <p class=admonition-title>Warning</p> <p>The module is outdated as the respective <a href="https://github.com/buckaroo-pm/nlohmann-json">repository</a> has not been updated in years.</p> </div> <h2 id=cocoapods>CocoaPods<a class=headerlink href=#cocoapods title="Permanent link">¶</a></h2> <p>If you are using <a href="https://cocoapods.org">CocoaPods</a>, you can use the library by adding pod <code>"nlohmann_json", '~>3.1.2'</code> to your podfile (see <a href="https://bitbucket.org/benman/nlohmann_json-cocoapod/src/master/">an example</a>). Please file issues <a href="https://bitbucket.org/benman/nlohmann_json-cocoapod/issues?status=new&status=open">here</a>.</p> <p><img alt src="../../assets/external/img.shields.io/cocoapods/v/nlohmann_json.svg"></p> <div class="admonition warning"> <p class=admonition-title>Warning</p> <p>The module is outdated as the respective <a href="https://cocoapods.org/pods/nlohmann_json">pod</a> has not been updated in years.</p> </div> <!-- 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="May 9, 2026 09:00:12 UTC">May 9, 2026</span> </span> </aside> </article> </div> <script>var tabs=__md_get("__tabs");if(Array.isArray(tabs))e:for(var set of document.querySelectorAll(".tabbed-set")){var labels=set.querySelector(".tabbed-labels");for(var 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> <script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script> </div> <button type=button 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 8z"/></svg> Back to top </button> </main> <footer class=md-footer> <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-2026 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 512 512"><!-- Font Awesome Free 7.1.0 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 2025 Fonticons, Inc.--><path d="M173.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.6m-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.3m44.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.9M252.8 8C114.1 8 8 113.3 8 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 Line truncated
|
||||
Reference in new issue
Block a user