title: jq error "object is not valid in a csv row"
body: <p>I'm using <code>jq</code> to convert a nested <code>.json</code> file to <code>.csv</code>, however, there seems to be an issue when I have a particular <strong>key</strong>, <strong>value</strong> within the <strong>JSON</strong>. The script I'm using comes from <a href="https://stackoverflow.com/a/44748291/499581">this answer</a>, which works if I eliminate one line from the input file.</p>
  
  <p><strong>ERROR</strong>:</p>
  
  <pre><code>jq: error (at example.json:0): object ({"favicon":...) is not valid in a csv row
  </code></pre>
  
  <p>The error message isn't very descriptive, since the object it mentions doesn't seem to be the culprit.</p>
  
  <p><strong>json2csv.jq</strong></p>
  
  <pre><code>paths as $path
  | {path: $path, value: getpath($path)}
  | select(.value|type == "object" )
  | select( [.value[]][0] | type != "object")
  | .path + ([.value[]])
  | @csv
  </code></pre>
  
  <p><strong>example.json</strong> (which validates with <a href="https://jsonlint.com" rel="noreferrer">https://jsonlint.com</a>):</p>
  
  <pre><code>{
    "items": [
      {
        "id": 1234,
        "title": "Title of Item",
        "internet": {
          "favicon": "https://example.com/icon.png",
          "domain": "https://example.com"
        },
        "image": {
          "gif": null,
          "main": "https://example.com/image_large.png"
        },
        "description": {
          "origin": null,
          "resource": null
        },
        "referral": {
          "owner": null,
          "name": null
        },
        "url": "https://example.com/image.png?version=1"
      }
    ],
    "other": {
      "data": 0,
      "notes": 1,
      "total": 1,
      "misc": 1
    }
  }
  </code></pre>
  
  <p>Removing the following from the <strong>JSON</strong> doesn't throw error from <code>jq</code>:</p>
  
  <pre><code>, "url": "https://example.com/image.png?version=1"
  </code></pre>
  
  <p><strong>Invocation</strong>:</p>
  
  <pre><code>$ jq -er -f json2csv.jq example.json
  </code></pre>
  
  <p>I can't really change the <code>.json</code> file, because it needs the problematic line, so I'm looking for a solution from <code>jq</code>.</p>