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

BIN
main

Binary file not shown.

View File

@ -20,7 +20,7 @@ proc do_loop[T](node: T,level : int, searchString : string = "", path: string =
stdout.write("\n") stdout.write("\n")
echo "childs: " echo "childs: "
for y in node.keys: for y in node.keys:
stdout.write y," [", node[y].kind,"] \n" stdout.write path & "-" & y," [", node[y].kind,"] \n"
do_another_loop(node,level+1,searchString,path & "-" & key) do_another_loop(node,level+1,searchString,path & "-" & key)
#children of currentObj #children of currentObj
@ -31,12 +31,13 @@ proc do_array_loop(node : JsonNode, level : int, searchString : string = "", pat
echo "Array Length", node.len() echo "Array Length", node.len()
echo "WWWWWWWWWWWWWWW" echo "WWWWWWWWWWWWWWW"
for b in node: for b in node:
echo "node , b: ", b, "array_node_len: ", b.len()," ,subkind: " ,b.kind, "mainkind: ", node.kind echo "\nnode , b: ", b, "array_node_len: ", b.len()," ,subkind: " ,b.kind, "mainkind: ", node.kind
do_another_loop(b,level+1,searchString,path & "-" & key) do_another_loop(b,level+1,searchString,path & "-" & key)
#if node[a].kind == JString: #if node[a].kind == JString:
#echo "String: ", node[a] #echo "String: ", node[a]
#stdout.write "\n" #stdout.write "\n"
proc do_another_loop[T]( node : T , level : int, searchString : string = "",path :string = "H") = proc do_another_loop[T]( node : T , level : int, searchString : string = "",path :string = "H") =
if node.len() > 0: if node.len() > 0:
if node.kind == JObject: if node.kind == JObject:
@ -45,6 +46,8 @@ proc do_another_loop[T]( node : T , level : int, searchString : string = "",path
do_loop(node[a],level,searchString,path, a) do_loop(node[a],level,searchString,path, a)
elif node[a].kind == JArray: elif node[a].kind == JArray:
do_array_loop(node[a],level,searchString,path,a) do_array_loop(node[a],level,searchString,path,a)
elif node[a].kind == JString:
echo "String: ",path & "-" & $node[a]
elif node.kind == JArray: elif node.kind == JArray:
do_array_loop(node,level,searchString,path) do_array_loop(node,level,searchString,path)