json/home/releases/index.html

10 lines
233 KiB
HTML
Raw Normal View History

<!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/home/releases/ rel=canonical><link href=../exceptions/ rel=prev><link href=../design_goals/ rel=next><link rel=icon href=../../assets/images/favicon.png><meta name=generator content="mkdocs-1.5.3, mkdocs-material-9.4.7"><title>Releases - JSON for Modern C++</title><link rel=stylesheet href=../../assets/stylesheets/main.4b4a2bd9.min.css><link rel=stylesheet href=../../assets/stylesheets/palette.356b1318.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=#releases 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> Releases </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
<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>&lt;&lt;</span><span class=w> </span><span class=n>key</span><span class=w> </span><span class=o>&lt;&lt;</span><span class=w> </span><span class=sc>&#39;:&#39;</span><span class=w> </span><span class=o>&lt;&lt;</span><span class=w> </span><span class=n>val</span><span class=w> </span><span class=o>&lt;&lt;</span><span class=w> </span><span class=sc>&#39;\n&#39;</span><span class=p>;</span>
<span class=p>}</span>
</code></pre></div> #1388 #1391</p> </li> <li> <p>Added support for <strong>reading from <code>FILE*</code></strong> to support situations in which streams are nit available or would require too much RAM. #1370 #1392</p> </li> </ul> <h3 id=bug-fixes_6><img alt=🐛 class=twemoji src=https://cdn.jsdelivr.net/gh/jdecked/twemoji@14.1.2/assets/svg/1f41b.svg title=:bug:> Bug Fixes<a class=headerlink href=#bug-fixes_6 title="Permanent link">&para;</a></h3> <ul> <li>The <code>eofbit</code> was not set for input streams when the end of a stream was reached while parsing. #1340 #1343</li> <li>Fixed a bug in the SAX parser for BSON arrays.</li> </ul> <h3 id=improvements_3><img alt= class=twemoji src=https://cdn.jsdelivr.net/gh/jdecked/twemoji@14.1.2/assets/svg/26a1.svg title=:zap:> Improvements<a class=headerlink href=#improvements_3 title="Permanent link">&para;</a></h3> <ul> <li>Added support for Clang 5.0.1 (PS4 version). #1341 #1342</li> </ul> <h3 id=further-changes_5><img alt=🔨 class=twemoji src=https://cdn.jsdelivr.net/gh/jdecked/twemoji@14.1.2/assets/svg/1f528.svg title=:hammer:> Further Changes<a class=headerlink href=#further-changes_5 title="Permanent link">&para;</a></h3> <ul> <li>Added a warning for implicit conversions to the documentation: It is not recommended to use implicit conversions when reading <strong>from</strong> a JSON value. Details about this recommendation can be found <a href=https://www.github.com/nlohmann/json/issues/958>here</a>. #1363</li> <li>Fixed typos in the documentation. #1329 #1380 #1382</li> <li>Fixed a C4800 warning. #1364</li> <li>Fixed a <code>-Wshadow</code> warning #1346</li> <li>Wrapped <code>std::snprintf</code> calls to avoid error in MSVC. #1337</li> <li>Added code to allow installation via Meson. #1345</li> </ul> <h3 id=deprecated-functions_6><img alt=🔥 class=twemoji src=https://cdn.jsdelivr.net/gh/jdecked/twemoji@14.1.2/assets/svg/1f525.svg title=:fire:> Deprecated functions<a class=headerlink href=#deprecated-functions_6 title="Permanent link">&para;</a></h3> <p>This release does not deprecate any functions. As an overview, the following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0):</p> <ul> <li>Function <a href=http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_af1592a06bc63811886ade4f9d965045e.html#af1592a06bc63811886ade4f9d965045e><code>iterator_wrapper</code></a> are deprecated. Please use the member function <a href=http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_afe3e137ace692efa08590d8df40f58dd.html#afe3e137ace692efa08590d8df40f58dd><code>items()</code></a> instead.</li> <li>Functions <a href=http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_ab7285a92514fcdbe6de505ebaba92ea3.html#ab7285a92514fcdbe6de505ebaba92ea3><code>friend std::istream&amp; operator&lt;&lt;(basic_json&amp;, std::istream&amp;)</code></a> and <a href=http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a9e06deabe69262c3ffc5533d32856983.html#a9e06deabe69262c3ffc5533d32856983><code>friend std::ostream&amp; operator&gt;&gt;(const basic_json&amp;, std::ostream&amp;)</code></a> are deprecated. Please use <a href=http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_aaf363408931d76472ded14017e59c9e8.html#aaf363408931d76472ded14017e59c9e8><code>friend std::istream&amp; operator&gt;&gt;(std::istream&amp;, basic_json&amp;)</code></a> and <a href=http://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a5e34c5435e557d0bf666bd7311211405.html#a5e34c5435e557d0bf666bd7311211405><code>friend operator&lt;&lt;(std::ostream&amp;, const basic_json&amp;)</code></a> instead.</li> </ul> <h2 id=v340>v3.4.0<a class=headerlink href=#v340 title="Permanent link">&para;</a></h2> <div class="admonition summary"> <p class=admonition-title>Files</p> <ul> <li><a href=https://github.com/nlohmann/json/releases/download/v3.4.0/include.zip>include.zip</a> (132 KB)</li> <li><a href=https://github.com/nlohmann/json/releases/download/v3.4.0/include.zip.asc>include.zip.asc</a
</code></pre></div> <p>New code:</p> <div class=highlight><pre><span></span><code><span class=n>json</span><span class=w> </span><span class=n>j</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>parse</span><span class=p>(</span><span class=n>ss</span><span class=p>,</span><span class=w> </span><span class=n>cb</span><span class=p>);</span>
</code></pre></div> <p>If no callback function is used, also the following code works:</p> <div class=highlight><pre><span></span><code><span class=n>json</span><span class=w> </span><span class=n>j</span><span class=p>;</span>
<span class=n>j</span><span class=w> </span><span class=o>&lt;&lt;</span><span class=w> </span><span class=n>ss</span><span class=p>;</span>
</code></pre></div> <p>or</p> <div class=highlight><pre><span></span><code><span class=n>json</span><span class=w> </span><span class=n>j</span><span class=p>;</span>
<span class=n>ss</span><span class=w> </span><span class=o>&gt;&gt;</span><span class=w> </span><span class=n>j</span><span class=p>;</span>
</code></pre></div> <h2 id=v211>v2.1.1<a class=headerlink href=#v211 title="Permanent link">&para;</a></h2> <div class="admonition summary"> <p class=admonition-title>Files</p> <ul> <li><a href=https://github.com/nlohmann/json/releases/download/v2.1.1/json.hpp>json.hpp</a> (437 KB)</li> <li><a href=https://github.com/nlohmann/json/releases/download/v2.1.1/json.hpp.asc>json.hpp.asc</a> (1 KB)</li> </ul> </div> <p>Release date: 2017-02-25 SHA-256: faa2321beb1aa7416d035e7417fcfa59692ac3d8c202728f9bcc302e2d558f57</p> <h3 id=summary_15>Summary<a class=headerlink href=#summary_15 title="Permanent link">&para;</a></h3> <p>This release <strong>fixes a locale-related bug in the parser</strong>. To do so, the whole number handling (lexer, parser, and also the serialization) have been overworked. Furthermore, a lot of small changes added up that were added to this release. All changes are backward-compatible.</p> <h3 id=changes_1>Changes<a class=headerlink href=#changes_1 title="Permanent link">&para;</a></h3> <ul> <li><img alt=🐛 class=twemoji src=https://cdn.jsdelivr.net/gh/jdecked/twemoji@14.1.2/assets/svg/1f41b.svg title=:bug:> Locales that have a different character than <code>.</code> as decimal separator (e.g., the Norwegian locale <code>nb_NO.UTF-8</code>) led to truncated number parsing or parse errors. The library now has been fixed to work with <strong>any locale</strong>. Note that <code>.</code> is still the only valid decimal separator for JSON input.</li> <li><img alt=🐛 class=twemoji src=https://cdn.jsdelivr.net/gh/jdecked/twemoji@14.1.2/assets/svg/1f41b.svg title=:bug:> Numbers like <code>1.0</code> were correctly parsed as floating-point number, but serialized as integer (<code>1</code>). Now, <strong>floating-point numbers correctly round trip</strong>.</li> <li><img alt=🐛 class=twemoji src=https://cdn.jsdelivr.net/gh/jdecked/twemoji@14.1.2/assets/svg/1f41b.svg title=:bug:> Parsing incorrect JSON numbers with leading 0 (<code>0123</code>) could yield a <a href=https://github.com/nlohmann/json/issues/452>buffer overflow</a>. This is fixed now by detecting such errors directly by the lexer.</li> <li><img alt=🐛 class=twemoji src=https://cdn.jsdelivr.net/gh/jdecked/twemoji@14.1.2/assets/svg/1f41b.svg title=:bug:> Constructing a JSON value from a pointer was incorrectly interpreted as a Boolean; such code will now yield a compiler error.</li> <li><img alt=🐛 class=twemoji src=https://cdn.jsdelivr.net/gh/jdecked/twemoji@14.1.2/assets/svg/1f41b.svg title=:bug:> Comparing a JSON number with <code>0</code> led to a comparison with <code>null</code>. This is fixed now.</li> <li><img alt=🐛 class=twemoji src=https://cdn.jsdelivr.net/gh/jdecked/twemoji@14.1.2/assets/svg/1f41b.svg title=:bug:> All throw calls are now wrapped in macros.</li> <li><img alt=🔒 class=twemoji src=https://cdn.jsdelivr.net/gh/jdecked/twemoji@14.1.2/assets/svg/1f512.svg title=:lock:> Starting during the preparation of this release (since 8 February 2017), commits and released files are <strong>cryptographically signed</strong> with <a href="https://keybase.io/nlohmann/pgp_keys.asc?fingerprint=797167ae41c0a6d9232e48457f3cea63ae251b69">this GPG key</a>. Previous releases have also been signed.</li> <li><img alt= class=twemoji src=https://cdn.jsdelivr.net/gh/jdecked/twemoji@14.1.2/assets/svg/2728.svg title=:sparkles:> The parser for MessagePack and CBOR now supports an optional start index parameter to define a byte offset for the parser.</li> <li><img alt=🚨 class=twemoji src=https://cdn.jsdelivr.net/gh/jdecked/twemoji@14.1.2/assets/svg/1f6a8.svg title=:rotating_light:> Some more warnings have been fixed. With Clang, the code compiles <strong>without warnings</strong> with <code>-Weverything</code> (well, it needs <code>-Wno-documentation-unknown-command</code> and <code>-Wno-deprecated-declarations</code>, but you get the point).</li> <li><img alt=🔨 class=twemoji src=https://cdn.jsdelivr.net/gh/jdecked/twemoji@14.1.2/assets/svg/1f528.svg title=:hammer:> The code can be compiled easier with many Android NDKs by avoiding macros l