This commit is contained in:
ccppi 2024-07-05 13:16:33 +02:00
parent 93bdbf42c9
commit 174cc637b1
2 changed files with 6 additions and 5 deletions

BIN
main

Binary file not shown.

View File

@ -20,18 +20,19 @@ proc do_loop[T](node: T,level : int, searchString : string = "", path: string =
stdout.write("\n")
echo "childs: "
for y in node.keys:
stdout.write ", " ,y," [", node[y].kind,"] \n"
stdout.write y," [", node[y].kind,"] \n"
do_another_loop(node,level+1,searchString,path & "-" & key)
#children of currentObj
proc do_array_loop(node : JsonNode, level : int, searchString : string = "", path: string = "") =
proc do_array_loop(node : JsonNode, level : int, searchString : string = "", path: string = "",key :string = "") =
if searchString == "" or node.contains(searchString):
echo "Key: ",key
echo "Array Elements: ", node.getElems()
echo "Array Length", node.len()
echo "WWWWWWWWWWWWWWW"
for b in node:
echo "array_node_len: ", b.len()," ,subkind: " ,b.kind, "mainkind: ", node.kind
do_another_loop(b,level+1,searchString,path & "-" & $node)
echo "node , b: ", b, "array_node_len: ", b.len()," ,subkind: " ,b.kind, "mainkind: ", node.kind
do_another_loop(b,level+1,searchString,path & "-" & key)
#if node[a].kind == JString:
#echo "String: ", node[a]
#stdout.write "\n"
@ -43,7 +44,7 @@ proc do_another_loop[T]( node : T , level : int, searchString : string = "",path
if node[a].kind == JObject:
do_loop(node[a],level,searchString,path, a)
elif node[a].kind == JArray:
do_array_loop(node[a],level,searchString,path)
do_array_loop(node[a],level,searchString,path,a)
elif node.kind == JArray:
do_array_loop(node,level,searchString,path)