From 0460b9097710e536907757bda8cfd7e949a9d82e Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Fri, 22 Jun 2018 22:35:48 +0200 Subject: [PATCH] :memo: fix for #1052 #1139 --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 691cd105..9faabf91 100644 --- a/README.md +++ b/README.md @@ -525,6 +525,14 @@ int vi = jn.get(); // etc. ``` +Note that `char` types are not automatically converted to JSON strings, but to integer numbers. A conversion to a string must be specified explicitly: + +```cpp +char ch = 'A'; // ASCII value 65 +json j_default = ch; // stores integer number 65 +json j_string = std::string(1, ch); // stores string "A" +``` + ### Arbitrary types conversions Every type can be serialized in JSON, not just STL containers and scalar types. Usually, you would do something along those lines: