title: Parsing ridiculous json string in php
body: <p>I am querying a restful web service (clickbank) I am able to send and receive my requests but (embarrassingly enough), I am having trouble parsing the results to make them readable. When I select XML as the return format what I get back is a 97,000 character long string(yay var_dump).... with no spaces in it... and no delimiter (such as ',' or '/', or even '&lt;', or '>'), separating the values. So, I have selected JSON as the return format. I have been able to decode this herculean string using json_decode and I have deciphered that what I am getting back is an array of 100 objects, each object has 30 vars (ala get_object_vars), but some of these vars are themselves arrays of objects. Forgive my ignorance but any ideas on how I can parse this so that it's in the realm of readable? By the way, I am currently trying my hand at PHP (as that is what we use at the shop where I work). I am mildly retarded when it comes to using Eclipse PDT so any suggestions would be welcome....
  P.S. I have the following function that has been helpful in determining what the hay is going on but it still doesn't separate things out like I want</p>
  
  <pre><code>function getInfo($datum) {  
      switch (gettype($datum)) {
  
          case "object":
              $GLOBALS['counts']++;
              //var_dump($datum);
              echo "&lt;hr&gt;";
              //$members = get_object_vars($datum);
              //getInfo($members);
              break;
          case "array":
                  foreach($datum as $v) {
                      getInfo($v);
                  }
                  //var_dump($datum);
                  break;
          default:
              echo "&lt;div&gt;$datum&lt;/div&gt;";                
      }
  }
  </code></pre>
  
  <p>This is a bit of a side question here: down at the bottom of my snippet (see the default condition of switch statement), $datum WAS part of an array (before it was passed back into the function at the final depth of recursion here). Is there a way to elaborate that echo statement so that it shows whatever it's key was? I'm trying to word this in the least confusing way possible, but if that value (probably a string) is the value of some index of an associative array, but without me having to specify any of the possible names of the arrays? (think in_array but without the $haystack argument)</p>