Use nil instead of null in json
This commit is contained in:
parent
0179d842dc
commit
95f4f70f2d
1 changed files with 1 additions and 4 deletions
|
|
@ -628,9 +628,6 @@ proc newJArray*(): JsonNode =
|
||||||
result.kind = JArray
|
result.kind = JArray
|
||||||
result.elems = @[]
|
result.elems = @[]
|
||||||
|
|
||||||
const
|
|
||||||
null*: string = nil ## alias for ``nil``
|
|
||||||
|
|
||||||
proc getStr*(n: JsonNode, default: string = ""): string =
|
proc getStr*(n: JsonNode, default: string = ""): string =
|
||||||
## Retrieves the string value of a `JString JsonNode`.
|
## Retrieves the string value of a `JString JsonNode`.
|
||||||
##
|
##
|
||||||
|
|
@ -1315,5 +1312,5 @@ when isMainModule:
|
||||||
]
|
]
|
||||||
doAssert j3 == %[%{"name": %"John", "age": %30}, %{"name": %"Susan", "age": %31}]
|
doAssert j3 == %[%{"name": %"John", "age": %30}, %{"name": %"Susan", "age": %31}]
|
||||||
|
|
||||||
var j4 = %*{"test": null}
|
var j4 = %*{"test": nil}
|
||||||
doAssert j4 == %{"test": newJNull()}
|
doAssert j4 == %{"test": newJNull()}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue