title: jq: error Cannot index string with string. How to parse json file with variable object values using jq
body: <p>I have a json file that looks like:</p>
  
  <pre><code>[
  {"start": "xxx", "final": {"name": "uuu", "content": "{'Date': 'Thu, 07 Mar 2019', 'Type': 'text'}"}},
  {"start": "yyy", "final": {"name": "nnn", "content": "{'Date': 'Thu, 07 Mar 2019'}"}}
  ]
  </code></pre>
  
  <p>The <code>"final"</code> holds an object which contains two keys: <code>name</code> and <code>content</code>. The <code>content</code> value is an object. It may be empty, and it may contains different keys. </p>
  
  <p>However, I am interested in certain keys if appeared in the <code>content</code>. In this example, if "Type" is included, I want to parse it. If not, just insert "not found".</p>
  
  <p>When I run this <code>jq</code> command, I get this error:</p>
  
  <pre><code>jq: error (at &lt;stdin&gt;:4): Cannot index string with string "Type"
  </code></pre>
  
  <p>This is because the second object in my json file does not contain <code>Type</code>.  </p>
  
  <p>Is there a solution to this problem?</p>
  
  <pre><code>cat test.json | jq -r '.[] | "\(.start),\(.final["name"]),\(.final["content"]["Type"])"'
  jq: error (at &lt;stdin&gt;:4): Cannot index string with string "Type"
  </code></pre>