From 3bef1a5097dee02554ad96db15e4d4a0c61795ad Mon Sep 17 00:00:00 2001
From: Niels <niels.lohmann@gmail.com>
Date: Sun, 4 Jan 2015 20:50:28 +0100
Subject: [PATCH] renamed "toString()" to "to_string()"

---
 README.md         |  2 +-
 src/json.cc       |  6 +++---
 src/json.h        |  6 +++---
 test/json_unit.cc | 14 +++++++-------
 4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/README.md b/README.md
index 600af59f..bc0cfe8d 100644
--- a/README.md
+++ b/README.md
@@ -116,7 +116,7 @@ You can also get a string representation (serialize):
 
 ```cpp
 // explicit conversion to string
-std::string s = j.toString();
+std::string s = j.to_string();
 ```
 
 The value of s could be `{"pi": 3.141, "happy": true}`, but the order of the entries in the object is not fixed.
diff --git a/src/json.cc b/src/json.cc
index b7702080..c8adce08 100644
--- a/src/json.cc
+++ b/src/json.cc
@@ -477,7 +477,7 @@ json::operator object_t() const
     return get<object_t>();
 }
 
-const std::string json::toString() const noexcept
+const std::string json::to_string() const noexcept
 {
     switch (_type)
     {
@@ -511,7 +511,7 @@ const std::string json::toString() const noexcept
                 {
                     result += ", ";
                 }
-                result += i->toString();
+                result += i->to_string();
             }
 
             return "[" + result + "]";
@@ -527,7 +527,7 @@ const std::string json::toString() const noexcept
                 {
                     result += ", ";
                 }
-                result += "\"" + i->first + "\": " + i->second.toString();
+                result += "\"" + i->first + "\": " + i->second.to_string();
             }
 
             return "{" + result + "}";
diff --git a/src/json.h b/src/json.h
index d8a0526c..fc46813d 100644
--- a/src/json.h
+++ b/src/json.h
@@ -181,13 +181,13 @@ class json
     /// write to stream
     friend std::ostream& operator<<(std::ostream& o, const json& j)
     {
-        o << j.toString();
+        o << j.to_string();
         return o;
     }
     /// write to stream
     friend std::ostream& operator>>(const json& j, std::ostream& o)
     {
-        o << j.toString();
+        o << j.to_string();
         return o;
     }
 
@@ -205,7 +205,7 @@ class json
     }
 
     /// explicit conversion to string representation (C++ style)
-    const std::string toString() const noexcept;
+    const std::string to_string() const noexcept;
 
     /// add an object/array to an array
     json& operator+=(const json&);
diff --git a/test/json_unit.cc b/test/json_unit.cc
index 8bd62922..c2cb0f3e 100644
--- a/test/json_unit.cc
+++ b/test/json_unit.cc
@@ -15,7 +15,7 @@ TEST_CASE("array")
         const json j_const (j);
 
         // string representation of default value
-        CHECK(j.toString() == "[]");
+        CHECK(j.to_string() == "[]");
 
         // iterators
         CHECK(j.begin() != j.end());
@@ -303,7 +303,7 @@ TEST_CASE("object")
         const json j_const = j;
 
         // string representation of default value
-        CHECK(j.toString() == "{}");
+        CHECK(j.to_string() == "{}");
 
         // iterators
         CHECK(j.begin() != j.end());
@@ -683,7 +683,7 @@ TEST_CASE("null")
         CHECK(j.type() == json::value_type::null);
 
         // string representation of default value
-        CHECK(j.toString() == "null");
+        CHECK(j.to_string() == "null");
 
         // iterators
         CHECK(j.begin() != j.end());
@@ -753,7 +753,7 @@ TEST_CASE("string")
         CHECK(j.cbegin() != j.cend());
 
         // string representation of default value
-        CHECK(j.toString() == "\"\"");
+        CHECK(j.to_string() == "\"\"");
 
         // container members
         CHECK(j.size() == 1);
@@ -835,7 +835,7 @@ TEST_CASE("boolean")
         CHECK(j.cbegin() != j.cend());
 
         // string representation of default value
-        CHECK(j.toString() == "false");
+        CHECK(j.to_string() == "false");
 
         // container members
         CHECK(j.size() == 1);
@@ -914,7 +914,7 @@ TEST_CASE("number (int)")
         CHECK(j.cbegin() != j.cend());
 
         // string representation of default value
-        CHECK(j.toString() == "0");
+        CHECK(j.to_string() == "0");
 
         // container members
         CHECK(j.size() == 1);
@@ -1000,7 +1000,7 @@ TEST_CASE("number (float)")
         CHECK(j.cbegin() != j.cend());
 
         // string representation of default value
-        CHECK(j.toString() == "0.000000");
+        CHECK(j.to_string() == "0.000000");
 
         // container members
         CHECK(j.size() == 1);