I want something exactly similar to estraverse
. I want to run a function for each node of this JSON object. I asked another question here but that did not solve my problem.
I want to be able to get each node, as is, and check it as a JSON object.
As an example, I want to see if a node's type is JSXText
and it has a non-empty value, then print that node's value:
if node.type == 'JSXText' and node.value.strip() != '':
print (node.value)
How can I get to that point? I can do this very easily in C#. Yet I can't transfer my knowledge to Python in this case.