title: Easier way to convert JSON to CSV?
body: <p>I have a pretty wonky JSON string that looks like this:</p>
  
  <pre><code>[[{
      "Table":{
          "Properties":{
              "name":"ABOUT",
              "uniqueConstraints":"{}"
          },
          "Attributes": [{
              "name":"NAME",
              "unique":"true",
              "nullable":"false",
              "insertable":"false",
              "updatable":"false"
          },{
              "name":"VERSION",
              "unique":"true",
              "nullable":"false",
              "insertable":"false",
              "updatable":"false"   // I will need to go back through and add empty element for 'section'
          },{
              "name":"BUILD",           
              "insertable":"true",        
              "section": 1                
          }],
          "FileName": "About.java"
  }]]
  </code></pre>
  
  <p>And I'm trying to get a CSV like this:</p>
  
  <pre><code>Entity | Property | Unique | Nullable | Insertable | Updatable | Section
  =======+==========+========+==========+============+===========+=========
  About  | Version  | True   | False    | False      | False     | 
  About  | Build    | False  | False    | True       | False     | 1
  </code></pre>
  
  <p>I have a ton of code that I'm currently using to parse this out, and I'm just wondering if anyone knows of an easier way I can accomplish this, with direct association with:</p>
  
  <ol>
  <li>Create a header array, we'll call it <code>header</code></li>
  <li>Create a csv array, we'll call that <code>csv</code></li>
  <li>Loop through each File and each table in file</li>
  <li>Loop through Attributes in each table</li>
  <li>Create a new array inside <code>csv</code> called <code>row</code></li>
  <li>Push the table name &amp; <code>Table.Attr[i].name</code> to <code>row</code></li>
  <li>Parse through each key/value in the Attr (except the name Attr)</li>
  <li>If the key is something that isn't in <code>header</code>, push it</li>
  <li>Use <code>header.indexOf(key)</code> to decide where values should be placed in <code>csv[row]</code></li>
  <li>After everything's done, go back through and add extra, empty elements to every row.</li>
  <li>For each row, <code>Join(",") + "\n"</code></li>
  </ol>