Merge pull request #410 from arcoRocks/patch-3

Fix for #409
This commit is contained in:
Jason Turner 2018-03-01 10:44:45 -07:00 committed by GitHub
commit 6a8541971e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -392,7 +392,7 @@ class JSON
bool skip = true;
for( auto &p : *internal.Map ) {
if( !skip ) { s += ",\n"; }
s += ( pad + "\"" + p.first + "\" : " + p.second.dump( depth + 1, tab ) );
s += ( pad + "\"" + json_escape(p.first) + "\" : " + p.second.dump( depth + 1, tab ) );
skip = false;
}
s += ( "\n" + pad.erase( 0, 2 ) + "}" ) ;

View File

@ -16,3 +16,4 @@ assert_equal(to_json(from_json("null")), "null")
assert_equal(from_json(to_json(["a": 5, "b": "stuff"])), ["a": 5, "b": "stuff"])
auto x = [3.5, true, false, "test", [], Vector(), Map()]
assert_equal(from_json(to_json(x)), x)
assert_equal(from_json(to_json(["aa\\zz":"aa\\zz"])), ["aa\\zz": "aa\\zz"])