使用 jq 将子字典的 属性 分配给父字典

Using jq to assign property of child to parent dictionary

我有一个包含多个几何图形的 TopoJSON 文件。看起来是这样的:

{
  "type": "Topology",
  "objects": {
    "delegaciones": {
      "geometries": [
        {
          "properties": {
            "name": "Tlalpan",
            "municip": "012",
            "id": "09012",
            "state": "09"
          }
...

我希望能够从 properties 中取出 id 字段,并将其分配给父级,这样结果是:

{
  "type": "Topology",
  "objects": {
    "delegaciones": {
      "geometries": [
        {
          "id": "09012",
          "properties": {
            "name": "Tlalpan",
            "municip": "012",
            "id": "09012", // <-- It's okay if it's removed or not
            "state": "09"
          }
...

我在 jq 上尝试了以下作业,但它不正确:

jq '.objects.delegaciones.geometries[].id = .objects.delegaciones.geometries[].properties.id' topo_df.json 

任何人都知道如何让 jq 逐一迭代元素?或者我怎样才能让它发挥作用?

下面按要求添加"id"属性:

.objects.delegaciones.geometries[] |= (.id = .properties.id)