Fixed indentation (2 spaces)
This commit is contained in:
parent
f1343e52e0
commit
11457bc63b
1 changed files with 21 additions and 21 deletions
|
|
@ -956,34 +956,34 @@ proc toUgly*(result: var string, node: JsonNode) =
|
||||||
var comma = false
|
var comma = false
|
||||||
case node.kind:
|
case node.kind:
|
||||||
of JArray:
|
of JArray:
|
||||||
result.add "["
|
result.add "["
|
||||||
for child in node.elems:
|
for child in node.elems:
|
||||||
if comma: result.add ","
|
if comma: result.add ","
|
||||||
else: comma = true
|
else: comma = true
|
||||||
result.toUgly child
|
result.toUgly child
|
||||||
result.add "]"
|
result.add "]"
|
||||||
of JObject:
|
of JObject:
|
||||||
result.add "{"
|
result.add "{"
|
||||||
for key, value in items(node.fields):
|
for key, value in items(node.fields):
|
||||||
if comma: result.add ","
|
if comma: result.add ","
|
||||||
else: comma = true
|
else: comma = true
|
||||||
result.add "\""
|
result.add "\""
|
||||||
result.add key.escapeJson()
|
result.add key.escapeJson()
|
||||||
result.add "\":"
|
result.add "\":"
|
||||||
result.toUgly value
|
result.toUgly value
|
||||||
result.add "}"
|
result.add "}"
|
||||||
of JString:
|
of JString:
|
||||||
result.add "\""
|
result.add "\""
|
||||||
result.add node.str.escapeJson()
|
result.add node.str.escapeJson()
|
||||||
result.add "\""
|
result.add "\""
|
||||||
of JInt:
|
of JInt:
|
||||||
result.add($node.num)
|
result.add($node.num)
|
||||||
of JFloat:
|
of JFloat:
|
||||||
result.add($node.fnum)
|
result.add($node.fnum)
|
||||||
of JBool:
|
of JBool:
|
||||||
result.add(if node.bval: "true" else: "false")
|
result.add(if node.bval: "true" else: "false")
|
||||||
of JNull:
|
of JNull:
|
||||||
result.add "null"
|
result.add "null"
|
||||||
|
|
||||||
proc toUgly*(node: JsonNode): string =
|
proc toUgly*(node: JsonNode): string =
|
||||||
## Converts `node` to its JSON Representation on one line.
|
## Converts `node` to its JSON Representation on one line.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue