title: Format nested JSON input using JQ?
body: <p>I am trying to convert the sample input below into the output below using jq:</p>
  <p><strong>Input JSON</strong></p>
  <pre><code>  &quot;elements&quot;: [
      {
        &quot;type&quot;: &quot;CustomObjectData&quot;,
        &quot;id&quot;: &quot;2185&quot;,
        &quot;fieldValues&quot;: [
          {
            &quot;type&quot;: &quot;FieldValue&quot;,
            &quot;id&quot;: &quot;169&quot;,
            &quot;value&quot;: &quot;9/6/2017 12:00:00 AM&quot;
          },
          {
            &quot;type&quot;: &quot;FieldValue&quot;,
            &quot;id&quot;: &quot;190&quot;,
            &quot;value&quot;: &quot;ABC&quot;
          } 
          ]
          },
   {
        &quot;type&quot;: &quot;CustomObjectData&quot;,
        &quot;id&quot;: &quot;2186&quot;,
        &quot;contactId&quot;: &quot;13&quot;,
        &quot;fieldValues&quot;: [
          {
            &quot;type&quot;: &quot;FieldValue&quot;,
            &quot;id&quot;: &quot;169&quot;,
            &quot;value&quot;: &quot;8/31/2017 12:00:00 AM&quot;
          },
          {
            &quot;type&quot;: &quot;FieldValue&quot;,
            &quot;id&quot;: &quot;190&quot;,
            &quot;value&quot;: &quot;DEF&quot;
          }
          ]
          }
  ]
  </code></pre>
  <p><strong>Desired Output (group by id)</strong></p>
  <p>Essentially trying to extract &quot;value&quot; field from each &quot;fieldValues&quot; object and group them by &quot;id&quot;</p>
  <pre><code>{
  &quot;id:&quot;2185&quot;,
  &quot;value&quot;: &quot;9/6/2017 12:00:00 AM&quot;,
   &quot;value&quot;: &quot;ABC&quot;
  },
  {
  &quot;id:&quot;2186&quot;,
  &quot;value&quot;: &quot;8/31/2017 12:00:00 AM&quot;,
   &quot;value&quot;: &quot;DEF&quot;
  }
  </code></pre>
  <p>What jq syntax should i use to achieve this? Thanks very much!!</p>