I need to parse a JSON file which is a binary tree. Also the depth of the nested tree is unknown. i.e. leftNode can be any deep.
leftNode= can be a binary/operator or a sub tree
center= always Operator
rightNode= alwasy a value/expression.
Here is the JSON file:
jsonInput={
"leftNode": {
"leftNode": {
"leftNode": {
"leftNode": {
"leftNode": "brand_name",
"rightNode": "brand_id",
"centerOperator": "OR"
},
"rightNode": "category_name",
"centerOperator": "AND"
},
"rightNode": "latitude",
"centerOperator": "AND"
},
"rightNode": "latitude",
"centerOperator": "AND"
},
"rightNode": "radius",
"centerOperator": "AND"
}
How do I iterate over such file. I want to convert this into this a tree like structure. thank you