Let us consider a tcl data as follows:
set arr {a {{c 1} {d {2 2 2} e 3}} b {{f 4 g 5}}}
Converted into Json format using huddle module:
set json_arr [huddle jsondump [huddle compile {dict * {list {dict d list}}} $arr] {} {}]
puts $json_arr
{"a":[{"c":1},{"d":[2,2,2],"e":3}],"b":[{"f":4,"g":5}]}
Here I have specified the structure of tcl array as {dict * {list {dict d list}}}
. But, I want to automate this part (don't want to manually find the structure).
I am able to determine the type of string, list and dict but unable to find the type of such variable or more complex than this.
Please post any suggestion or other way for the same.