title: How do I convert a nested JSON into a comma separated file for analysis? Below are the details
body: <p>Need to parse the following Json like the following-</p>
  <p>new.json</p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;name&quot;: &quot;johnDoe&quot;,
    &quot;dept&quot;: 45,
    &quot;details&quot;: [
      {
        &quot;salary&quot;: &quot;76566&quot;,
        &quot;weight&quot;: &quot;150&quot;,
        &quot;height&quot;: &quot;160&quot;,
        &quot;sex&quot;: &quot;male&quot;,
        &quot;country&quot;: &quot;Usa&quot;,
        &quot;State&quot;: &quot;NJ&quot;
      },
      {
        &quot;salary&quot;: &quot;76560&quot;,
        &quot;weight&quot;: &quot;160&quot;,
        &quot;height&quot;: &quot;180&quot;,
        &quot;sex&quot;: &quot;male&quot;,
        &quot;country&quot;: &quot;Usa&quot;,
        &quot;State&quot;: &quot;NC&quot;
      }
    ]
  }
  {
    &quot;name&quot;: &quot;DanLee&quot;,
    &quot;dept&quot;: 46,
    &quot;details&quot;: [
      {
        &quot;salary&quot;: &quot;76566&quot;,
        &quot;weight&quot;: &quot;180&quot;,
        &quot;height&quot;: &quot;160&quot;,
        &quot;sex&quot;: &quot;male&quot;,
        &quot;country&quot;: &quot;Usa&quot;,
        &quot;State&quot;: &quot;NJ&quot;
      },
      {
        &quot;salary&quot;: &quot;76560&quot;,
        &quot;weight&quot;: &quot;190&quot;,
        &quot;height&quot;: &quot;180&quot;,
        &quot;sex&quot;: &quot;male&quot;,
        &quot;country&quot;: &quot;Usa&quot;,
        &quot;State&quot;: &quot;NC&quot;
      },
      {
        &quot;salary&quot;: &quot;87888&quot;,
        &quot;weight&quot;: &quot;170&quot;,
        &quot;height&quot;: &quot;160&quot;,
        &quot;sex&quot;: &quot;male&quot;,
        &quot;country&quot;: &quot;Usa&quot;,
        &quot;State&quot;: &quot;NY&quot;
      }
    ]
  }
  </code></pre>
  <p>Need name, weight and State information extracted from the above Json format and get a comma separated file for analysis like this:</p>
  <pre><code>name,weight,State
  johnDoe,150,NJ
  johnDoe,160,NC
  DanLee,180,NJ
  DanLee,190,NC
  DanLee,170,NY
  </code></pre>
  <p>I have just started to use Jq in Linux and would like to understand how such conversion can be done with a step by step explanation.</p>
  <p>Thanks.</p>