From ca2bbdb15b761184744db4c46fdc3167d620a26f Mon Sep 17 00:00:00 2001
From: Niels <niels.lohmann@gmail.com>
Date: Fri, 24 Jun 2016 07:39:08 +0200
Subject: [PATCH 1/9] clarified MSV version

---
 README.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 21ff3c59..881460f4 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-![JSON for Modern C++](https://raw.githubusercontent.com/nlohmann/json/master/doc/json.gif)
+[![JSON for Modern C++](https://raw.githubusercontent.com/nlohmann/json/master/doc/json.gif)](https://github.com/nlohmann/json/releases)
 
 [![Build Status](https://travis-ci.org/nlohmann/json.svg?branch=master)](https://travis-ci.org/nlohmann/json)
 [![Build Status](https://ci.appveyor.com/api/projects/status/1acb366xfyg3qybk?svg=true)](https://ci.appveyor.com/project/nlohmann/json)
@@ -390,7 +390,7 @@ Though it's 2016 already, the support for C++11 is still a bit sparse. Currently
 
 - GCC 4.9 - 6.0 (and possibly later)
 - Clang 3.4 - 3.9 (and possibly later)
-- Microsoft Visual C++ 2015 / 14.0 (and possibly later)
+- Microsoft Visual C++ 2015 / 14.0, MSVC 19.0 (and possibly later)
 
 I would be happy to learn about other compilers/versions.
 

From 0767290c2605cb238865260da261c7d294b83edd Mon Sep 17 00:00:00 2001
From: Niels <niels.lohmann@gmail.com>
Date: Fri, 24 Jun 2016 08:06:41 +0200
Subject: [PATCH 2/9] off-by-one error in the documentation

---
 README.md         | 2 +-
 test/src/unit.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 881460f4..d2a1ef56 100644
--- a/README.md
+++ b/README.md
@@ -323,7 +323,7 @@ json j_original = R"({
 })"_json;
 
 // access members with a JSON pointer (RFC 6901)
-j_original["/baz/2"_json_pointer];
+j_original["/baz/1"_json_pointer];
 // "two"
 
 // a JSON patch (RFC 6902)
diff --git a/test/src/unit.cpp b/test/src/unit.cpp
index 298a2bb1..fe3bc773 100644
--- a/test/src/unit.cpp
+++ b/test/src/unit.cpp
@@ -10531,7 +10531,7 @@ TEST_CASE("README", "[hide]")
         })"_json;
 
         // access members with a JSON pointer (RFC 6901)
-        j_original["/baz/2"_json_pointer];
+        j_original["/baz/1"_json_pointer];
         // "two"
 
         // a JSON patch (RFC 6902)

From 6aad67af2397000c05214e6e605118de732443de Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?M=C3=A1rio=20Feroldi?= <thlst1101@gmail.com>
Date: Fri, 24 Jun 2016 05:47:00 -0300
Subject: [PATCH 3/9] fixed a tiny typo

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index d2a1ef56..230cfd6b 100644
--- a/README.md
+++ b/README.md
@@ -291,7 +291,7 @@ json j_umset(c_umset); // both entries for "one" are used
 // maybe ["one", "two", "one", "four"]
 ```
 
-Likewise, any associative key-value containers (`std::map`, `std::multimap`, `std::unordered_map`, `std::unordered_multimap`) whose keys are can construct an `std::string` and whose values can be used to construct JSON types (see examples above) can be used to to create a JSON object. Note that in case of multimaps only one key is used in the JSON object and the value depends on the internal order of the STL container.
+Likewise, any associative key-value containers (`std::map`, `std::multimap`, `std::unordered_map`, `std::unordered_multimap`) whose keys can construct an `std::string` and whose values can be used to construct JSON types (see examples above) can be used to to create a JSON object. Note that in case of multimaps only one key is used in the JSON object and the value depends on the internal order of the STL container.
 
 ```cpp
 std::map<std::string, int> c_map { {"one", 1}, {"two", 2}, {"three", 3} };

From c74b9ff4f7d5d0e11f711292165f17423d8233f1 Mon Sep 17 00:00:00 2001
From: Niels <niels.lohmann@gmail.com>
Date: Fri, 24 Jun 2016 17:15:54 +0200
Subject: [PATCH 4/9] another fix for the MSVC version

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 230cfd6b..0ab6adcb 100644
--- a/README.md
+++ b/README.md
@@ -390,7 +390,7 @@ Though it's 2016 already, the support for C++11 is still a bit sparse. Currently
 
 - GCC 4.9 - 6.0 (and possibly later)
 - Clang 3.4 - 3.9 (and possibly later)
-- Microsoft Visual C++ 2015 / 14.0, MSVC 19.0 (and possibly later)
+- Microsoft Visual C++ 2015 / Build Tools 14.0.25123.0 (and possibly later)
 
 I would be happy to learn about other compilers/versions.
 

From 360f0f3791d4c2c36bc0710885c1c88d47103c13 Mon Sep 17 00:00:00 2001
From: Niels <niels.lohmann@gmail.com>
Date: Fri, 24 Jun 2016 17:39:03 +0200
Subject: [PATCH 5/9] updated README and ChangeLog

---
 ChangeLog.md | 7 ++++++-
 README.md    | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ChangeLog.md b/ChangeLog.md
index ae9e562f..2a8d85d3 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -3,7 +3,12 @@ All notable changes to this project will be documented in this file. This projec
 
 ## [Unreleased](https://github.com/nlohmann/json/tree/HEAD)
 
-[Full Changelog](https://github.com/nlohmann/json/compare/v1.1.0...HEAD)
+[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.0...HEAD)
+
+- fixed a tiny typo [\#271](https://github.com/nlohmann/json/pull/271) ([thelostt](https://github.com/thelostt))
+
+## [v2.0.0](https://github.com/nlohmann/json/releases/tag/v2.0.0) (2016-06-23)
+[Full Changelog](https://github.com/nlohmann/json/compare/v1.1.0...v2.0.0)
 
 - concatenate objects [\#252](https://github.com/nlohmann/json/issues/252)
 - Unit test fails when doing a CMake out-of-tree build [\#241](https://github.com/nlohmann/json/issues/241)
diff --git a/README.md b/README.md
index 0ab6adcb..c271f76c 100644
--- a/README.md
+++ b/README.md
@@ -483,6 +483,7 @@ I deeply appreciate the help of the following people.
 - [Róbert Márki](https://github.com/robertmrk) added a fix to use move iterators and improved the integration via CMake.
 - [Chris Kitching](https://github.com/ChrisKitching) cleaned up the CMake files.
 - [Tom Needham](https://github.com/06needhamt) fixed a subtle bug with MSVC 2015 which was also proposed by [Michael K.](https://github.com/Epidal).
+- [Mário Feroldi](https://github.com/thelostt) fixed a small typo.
 
 Thanks a lot for helping out!
 

From 420659f1870b0871dfaf31d106bf9fcc8bc0dfd1 Mon Sep 17 00:00:00 2001
From: Niels <niels.lohmann@gmail.com>
Date: Tue, 28 Jun 2016 10:42:17 +0200
Subject: [PATCH 6/9] addressing #272

---
 src/json.hpp      | 11 ++++++-----
 src/json.hpp.re2c | 11 ++++++-----
 test/src/unit.cpp |  4 ++++
 3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/json.hpp b/src/json.hpp
index b02a1344..3c57c42f 100644
--- a/src/json.hpp
+++ b/src/json.hpp
@@ -2097,6 +2097,8 @@ class basic_json
     string_t dump(const int indent = -1) const
     {
         std::stringstream ss;
+        // fix locale problems
+        ss.imbue(std::locale(std::locale(), new DecimalSeparator));
 
         if (indent >= 0)
         {
@@ -5655,6 +5657,8 @@ class basic_json
 
         // reset width to 0 for subsequent calls to this stream
         o.width(0);
+        // fix locale problems
+        o.imbue(std::locale(std::locale(), new DecimalSeparator));
 
         // do the actual serialization
         j.dump(o, pretty_print, static_cast<unsigned int>(indentation));
@@ -6128,11 +6132,8 @@ class basic_json
                     // string->double->string or string->long
                     // double->string; to be safe, we read this value from
                     // std::numeric_limits<number_float_t>::digits10
-                    std::stringstream ss;
-                    ss.imbue(std::locale(std::locale(), new DecimalSeparator));  // fix locale problems
-                    ss << std::setprecision(std::numeric_limits<double>::digits10)
-                       << m_value.number_float;
-                    o << ss.str();
+                    o << std::setprecision(std::numeric_limits<double>::digits10)
+                      << m_value.number_float;
                 }
                 return;
             }
diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c
index aba10b49..63141e20 100644
--- a/src/json.hpp.re2c
+++ b/src/json.hpp.re2c
@@ -2097,6 +2097,8 @@ class basic_json
     string_t dump(const int indent = -1) const
     {
         std::stringstream ss;
+        // fix locale problems
+        ss.imbue(std::locale(std::locale(), new DecimalSeparator));
 
         if (indent >= 0)
         {
@@ -5655,6 +5657,8 @@ class basic_json
 
         // reset width to 0 for subsequent calls to this stream
         o.width(0);
+        // fix locale problems
+        o.imbue(std::locale(std::locale(), new DecimalSeparator));
 
         // do the actual serialization
         j.dump(o, pretty_print, static_cast<unsigned int>(indentation));
@@ -6128,11 +6132,8 @@ class basic_json
                     // string->double->string or string->long
                     // double->string; to be safe, we read this value from
                     // std::numeric_limits<number_float_t>::digits10
-                    std::stringstream ss;
-                    ss.imbue(std::locale(std::locale(), new DecimalSeparator));  // fix locale problems
-                    ss << std::setprecision(std::numeric_limits<double>::digits10)
-                       << m_value.number_float;
-                    o << ss.str();
+                    o << std::setprecision(std::numeric_limits<double>::digits10)
+                      << m_value.number_float;
                 }
                 return;
             }
diff --git a/test/src/unit.cpp b/test/src/unit.cpp
index fe3bc773..af16f00d 100644
--- a/test/src/unit.cpp
+++ b/test/src/unit.cpp
@@ -14079,6 +14079,10 @@ TEST_CASE("regression tests")
         CHECK(j1a.dump() == "23.42");
         CHECK(j1b.dump() == "23.42");
 
+        std::stringstream ss;
+        ss << j1a;
+        CHECK(ss.str() == "23.42");
+
         CHECK(j2a.dump() == "23.42");
         //issue #230
         //CHECK(j2b.dump() == "23.42");

From 7214243d89b166d8b52c18a997720a5fe4be2fe6 Mon Sep 17 00:00:00 2001
From: Niels <niels.lohmann@gmail.com>
Date: Tue, 28 Jun 2016 19:18:23 +0200
Subject: [PATCH 7/9] reset locale (for #272)

---
 src/json.hpp      | 5 ++++-
 src/json.hpp.re2c | 5 ++++-
 test/src/unit.cpp | 8 +++++++-
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/json.hpp b/src/json.hpp
index 3c57c42f..7adcbb43 100644
--- a/src/json.hpp
+++ b/src/json.hpp
@@ -5658,10 +5658,13 @@ class basic_json
         // reset width to 0 for subsequent calls to this stream
         o.width(0);
         // fix locale problems
-        o.imbue(std::locale(std::locale(), new DecimalSeparator));
+        auto old_locale = o.imbue(std::locale(std::locale(), new DecimalSeparator));
 
         // do the actual serialization
         j.dump(o, pretty_print, static_cast<unsigned int>(indentation));
+
+        // reset locale
+        o.imbue(old_locale);
         return o;
     }
 
diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c
index 63141e20..4b86afd6 100644
--- a/src/json.hpp.re2c
+++ b/src/json.hpp.re2c
@@ -5658,10 +5658,13 @@ class basic_json
         // reset width to 0 for subsequent calls to this stream
         o.width(0);
         // fix locale problems
-        o.imbue(std::locale(std::locale(), new DecimalSeparator));
+        auto old_locale = o.imbue(std::locale(std::locale(), new DecimalSeparator));
 
         // do the actual serialization
         j.dump(o, pretty_print, static_cast<unsigned int>(indentation));
+
+        // reset locale
+        o.imbue(old_locale);
         return o;
     }
 
diff --git a/test/src/unit.cpp b/test/src/unit.cpp
index af16f00d..1f5c6d9f 100644
--- a/test/src/unit.cpp
+++ b/test/src/unit.cpp
@@ -14079,9 +14079,15 @@ TEST_CASE("regression tests")
         CHECK(j1a.dump() == "23.42");
         CHECK(j1b.dump() == "23.42");
 
+        // check if locale is properly reset
         std::stringstream ss;
+        ss.imbue(std::locale(std::locale(), new CommaDecimalSeparator));
+        ss << 47.11;
+        CHECK(ss.str() == "47,11");
         ss << j1a;
-        CHECK(ss.str() == "23.42");
+        CHECK(ss.str() == "47,1123.42");
+        ss << 47.11;
+        CHECK(ss.str() == "47,1123.4247,11");
 
         CHECK(j2a.dump() == "23.42");
         //issue #230

From a73bda814723f71ee5a55e8af8903667623977f8 Mon Sep 17 00:00:00 2001
From: Niels <niels.lohmann@gmail.com>
Date: Tue, 28 Jun 2016 21:24:18 +0200
Subject: [PATCH 8/9] fixed performance regression #272

---
 README.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index c271f76c..4ad40373 100644
--- a/README.md
+++ b/README.md
@@ -484,6 +484,7 @@ I deeply appreciate the help of the following people.
 - [Chris Kitching](https://github.com/ChrisKitching) cleaned up the CMake files.
 - [Tom Needham](https://github.com/06needhamt) fixed a subtle bug with MSVC 2015 which was also proposed by [Michael K.](https://github.com/Epidal).
 - [Mário Feroldi](https://github.com/thelostt) fixed a small typo.
+- [duncanwerner](https://github.com/duncanwerner) found a really embarrassing performance regression in the 2.0.0 release.
 
 Thanks a lot for helping out!
 
@@ -503,7 +504,7 @@ $ make
 $ ./json_unit "*"
 
 ===============================================================================
-All tests passed (5568715 assertions in 32 test cases)
+All tests passed (5568718 assertions in 32 test cases)
 ```
 
 For more information, have a look at the file [.travis.yml](https://github.com/nlohmann/json/blob/master/.travis.yml).

From 026fe8041db32d226a902bc1da10c7014c94ff5c Mon Sep 17 00:00:00 2001
From: Niels <niels.lohmann@gmail.com>
Date: Tue, 28 Jun 2016 21:33:34 +0200
Subject: [PATCH 9/9] adjusted Changelog

---
 ChangeLog.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ChangeLog.md b/ChangeLog.md
index 2a8d85d3..0565f288 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file. This projec
 
 [Full Changelog](https://github.com/nlohmann/json/compare/v2.0.0...HEAD)
 
+- dump\(\) performance degradation in v2 [\#272](https://github.com/nlohmann/json/issues/272)
+
 - fixed a tiny typo [\#271](https://github.com/nlohmann/json/pull/271) ([thelostt](https://github.com/thelostt))
 
 ## [v2.0.0](https://github.com/nlohmann/json/releases/tag/v2.0.0) (2016-06-23)