title: Is there a way to execute jq from python
body: <p>I'm trying to execute a jq command from my python script. Currently the jq command is working fine when I execute from the terminal (MacOs).</p>
  
  <pre><code>cat filename.json |jq '{Name:.name, address:.address[0][1].street}'
  </code></pre>
  
  <p>Basically I'm trying to extract data from a JSON using jq. As the JSON contains nested arrays, I would have to loop using a variable.</p>
  
  <p>My questions is - </p>
  
  <ul>
  <li>Can I execute this command from a python script</li>
  <li>If it can be done, then how would I loop through for the nested array </li>
  <li>elements in the sample data give above (address[][].street)</li>
  </ul>
  
  <p>I don't want to use any language other than python, as it would cause compatibility issues.</p>