summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md4
1 files changed, 4 insertions, 0 deletions
diff --git a/README.md b/README.md
index a2dfe71..45e1348 100644
--- a/README.md
+++ b/README.md
@@ -214,6 +214,10 @@ json = JSON.generate [1, 2, {"a"=>3.141}, false, true, nil, 4..10]
# => "[1,2,{\"a\":3.141},false,true,null,{\"json_class\":\"Range\",\"data\":[4,10,false]}]"
JSON.parse json
# => [1, 2, {"a"=>3.141}, false, true, nil, 4..10]
+json = JSON.generate [1, 2, {"a"=>3.141}, false, true, nil, 4..10]
+# => "[1,2,{\"a\":3.141},false,true,null,{\"json_class\":\"Range\",\"data\":[4,10,false]}]"
+JSON.parse json, :create_additions => true
+# => [1, 2, {"a"=>3.141}, false, true, nil, 4..10]
```
`JSON.generate` always creates the shortest possible string representation of a