summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorDominik Picheta <dominikpicheta@googlemail.com>2015-05-18 21:57:59 +0100
committerDominik Picheta <dominikpicheta@googlemail.com>2015-05-18 21:57:59 +0100
commit59e95c015ef19512ab9ded6f26956782ea3b61b3 (patch)
tree57ce1db169ce2d6f1e4e79c39176cc25d8ba6619 /lib
parentf85dab3076dd4fa97909364877870af741a66ab6 (diff)
downloadNim-59e95c015ef19512ab9ded6f26956782ea3b61b3.tar.gz
Fixes problems introduced by #2738. Closes 2755.
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/json.nim10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/pure/json.nim b/lib/pure/json.nim
index 7d22e897b..518572be3 100644
--- a/lib/pure/json.nim
+++ b/lib/pure/json.nim
@@ -970,15 +970,12 @@ proc toUgly*(result: var string, node: JsonNode) =
     for key, value in items(node.fields):
       if comma: result.add ","
       else:     comma = true
-      result.add "\""
       result.add key.escapeJson()
-      result.add "\":"
+      result.add ":"
       result.toUgly value
     result.add "}"
   of JString:
-    result.add "\""
     result.add node.str.escapeJson()
-    result.add "\""
   of JInt:
     result.add($node.num)
   of JFloat:
@@ -1215,6 +1212,11 @@ when isMainModule:
   testJson{["c", "d"]} = %true
   assert(testJson["c"]["d"].bval)
 
+  # test `$`
+  let stringified = $testJson
+  let parsedAgain = parseJson(stringified)
+  assert(parsedAgain["b"].str == "asd")
+
   # Bounds checking
   try:
     let a = testJson["a"][9]