mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2025-12-06 08:46:53 +08:00
Merge branch 'develop' of github.com:ChaiScript/ChaiScript into develop
This commit is contained in:
commit
ef47b4582e
@ -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 ) + "}" ) ;
|
||||
|
||||
@ -110,7 +110,7 @@ namespace chaiscript
|
||||
{
|
||||
return json::JSON(bn.get_as<double>());
|
||||
} else {
|
||||
return json::JSON(bn.get_as<long>());
|
||||
return json::JSON(bn.get_as<std::int64_t>());
|
||||
}
|
||||
} catch (const chaiscript::detail::exception::bad_any_cast &) {
|
||||
// not a number
|
||||
|
||||
@ -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"])
|
||||
|
||||
@ -1,2 +1,3 @@
|
||||
assert_equal(from_json("100"), 100)
|
||||
assert_equal(from_json("-100"), -100)
|
||||
assert_equal(to_json(4294967295), "4294967295")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user