diff --git a/karax/jjson.nim b/karax/jjson.nim index 88580f9..ad6106b 100644 --- a/karax/jjson.nim +++ b/karax/jjson.nim @@ -19,9 +19,12 @@ proc newJsonNode*(fields: varargs[(cstring, JsonNode)]): JsonNode = proc newJObject*(): JsonNode = result = JsonNode() +proc newJArray*(elements: varargs[JsonNode]): JsonNode {.importcpp: "#".} + proc newJNull*(): JsonNode = nil template `%`*(x: typed): JsonNode = cast[JsonNode](x) +template `%`*(x: string): JsonNode = cast[JsonNode](cstring x) proc getNum*(x: JsonNode): int {.importcpp: "#".} @@ -31,3 +34,34 @@ proc getFNum*(x: JsonNode): cstring {.importcpp: "#".} iterator items*(x: JsonNode): JsonNode = for i in 0..