Create object id from JSON key value using jq : <p>I am trying to restructure my JSON by assigning an id to each object in a given array. This id would be created by using an existing key value (osm_id). </p>

<p>This is my input:</p>

<pre><code>[ 
{
  "geometry" : {
    "coordinates" : [ -0.7118478, 51.0930284 ],
    "type" : "Point"
  },
  "properties" : {
    "osm_id" : "262661",
    "religion" : "christian"
  },
  "type" : "Feature"
}, 
{
  "geometry" : {
    "coordinates" : [ -0.7207513, 51.0897118 ],
    "type" : "Point"
  },
  "properties" : {
    "denomination" : "catholic",
    "osm_id" : "262662",
    "religion" : "christian"
  },
  "type" : "Feature"
}
]
</code></pre>

<p>This is my desired output:</p>

<pre><code>[
"262661": {
  "geometry": {
    "coordinates": [
      -0.7118478,
      51.0930284
    ],
    "type": "Point"
  },
  "properties": {
    "osm_id": "262661",
    "religion": "christian"
  },
  "type": "Feature"
},
"262662": {
  "geometry": {
    "coordinates": [
      -0.7207513,
      51.0897118
    ],
    "type": "Point"
  },
  "properties": {
     "denomination": "catholic",
     "osm_id": "262662",
     "religion": "christian"
  },
  "type": "Feature"
}
]
</code></pre>

<p>I've been trying to work with jq to update the data, but I can't figure out how to assign that top level id. So far I have </p>

<pre><code>.[] |= {geometry, properties, type}
</code></pre>

<p>but anything further results in errors. </p>

<p>I appreciate any help or input. </p>
