title: Traversing a JSON in Python
body: <p>I am trying to traverse each 'node?' of a JSON objet in python. I am trying to implement a recursive function like  </p>
  
  <pre><code>def function(data):
           for element in data:
                  --- do something----
                  if (some condition):
                          function(element)
  </code></pre>
  
  <p>what I want to know is how can I find if the element in question is another object or just a string. That is, what should I write instead of 'some condition' in my above code. Like when I travese an XML , I check if it has any children using getchildren() and if it does, I recursively call the function again.....</p>