title: List all keys and values of JSON
body: <p>Say I have some JSON like the following:</p>
  
  <pre><code>{
  "items":
      {
          "item":
              [
                  {
                      "id": "0001",
                      "type": "donut",
                      "name": "Cake",
                      "ppu": 0.55,
                      "batters":
                          {
                              "batter":
                                  [
                                      { "id": "1001", "type": "Regular" },
                                      { "id": "1002", "type": "Chocolate" },
                                      { "id": "1003", "type": "Blueberry" },
                                      { "id": "1004", "type": "Devil's Food" }
                                  ]
                          },
                      "topping":
                          [
                              { "id": "5001", "type": "None" },
                              { "id": "5002", "type": "Glazed" },
                              { "id": "5005", "type": "Sugar" },
                              { "id": "5007", "type": "Powdered Sugar" },
                              { "id": "5006", "type": "Chocolate with Sprinkles" },
                              { "id": "5003", "type": "Chocolate" },
                              { "id": "5004", "type": "Maple" }
                          ]
                  },
  
                  ...
  
              ]
      }
  }
  </code></pre>
  
  <p>I'd like a function to return a list of tab delimited data (where -> is a tab). Something like this:</p>
  
  <pre><code>items.item.length -&gt; 1
  items.item[0].id -&gt; 0001
  items.item[0].type -&gt; donut
  items.item[0].name -&gt; Cake
  items.item[0].ppu -&gt; 0.55
  items.item[0].batters.batter.length -&gt; 4
  items.item[0].batters.batter[0].id -&gt; 1001
  items.item[0].batters.batter[0].type -&gt; Regular
  items.item[0].batters.batter[1].id -&gt; 1002
  items.item[0].batters.batter[1].type -&gt; Chocolate
  items.item[0].batters.batter[2].id -&gt; 1003
  items.item[0].batters.batter[2].type -&gt; Blueberry
  items.item[0].batters.batter[3].id -&gt; 1004
  items.item[0].batters.batter[3].type -&gt; Devil's Food
  items.item[0].topping.length -&gt; 7
  items.item[0].topping[0].id -&gt; 5001
  items.item[0].topping[0].type -&gt; None
  items.item[0].topping[0].id -&gt; 5002
  items.item[0].topping[0].type -&gt; Glazed
  
  ...
  </code></pre>
  
  <p>I'm thinking of something like</p>
  
  <pre><code>function json2txt(obj) {
  var txt = '';
      for (var key in obj) {
         if (obj.hasOwnProperty(key)) {
            if ("object" == typeof(obj[key])) {
               json2txt(obj[key]);
            } else txt += obj + '\t' + obj[key] + '\r';
         }
      }
  }
  </code></pre>
  
  <p>"Oops! Your edit couldn't be submitted because:</p>
  
  <p>Your post does not have much context to explain the code sections; please explain your scenario more clearly."</p>
  
  <p>This is pretty frustrating too.</p>