The problem must be solved by recursively calling a function to traverse the entire tree with an unknown number and size of "branches" in advance
At the same time, there is no need to reinvent the wheel, there is practically a similar function for Mikrotik - here it is (the author of the greatChupaka,
https://github.com/Winand/mikrotik-json-parser)
# ------------------------------- fJParsePrint ---------------------------------------------------------------- :global fJParsePrint :if (!any $fJParsePrint) do={ :global fJParsePrint do={ :global JParseOut :local TempPath :global fJParsePrint :if ([:len $1] = 0) do={ :set $1 "\$JParseOut" :set $2 $JParseOut } :foreach k,v in=$2 do={ :if ([:typeof $k] = "str") do={ :set k "\"$k\"" } :set TempPath ($1. "->" . $k) :if ([:typeof $v] = "array") do={ :if ([:len $v] > 0) do={ $fJParsePrint $TempPath $v } else={ :put "$TempPath = [] ($[:typeof $v])" } } else={ :put "$TempPath = $v ($[:typeof $v])" } } }}
How to do it ? Who can help ? Maybe our Dear Guru Rextended?