jsonparser icon indicating copy to clipboard operation
jsonparser copied to clipboard

how to merge two arrays

Open aqsyonas opened this issue 6 years ago • 0 comments

Greetings, i have two json objects like below. First One.

[
  {
    "data_header": {
      "callid": "[email protected]_b2b-1"
    },
    "id": 676,
    "protocol_header": {
      "captureId": "2001"
    }
  }
]

Second One.

[
  {
    "id": 54,
    "protocol_header": {
      "captureId": "2002"
    },
    "data_header": {
      "callid": "[email protected]",
      "node": "2001"
    }
  }
]

I would like to merge them so they like below.

[
  {
    "id": 54,
    "protocol_header": {
      "captureId": "2002"
    },
    "data_header": {
      "callid": "[email protected]",
      "node": "2001"
    }
  },
  {
    "data_header": {
      "callid": "[email protected]_b2b-1"
    },
    "id": 676,
    "protocol_header": {
      "captureId": "2001"
    }
  }
]

Any hint how can I achieve the above result?

Br, Aqs.

aqsyonas avatar Aug 24 '19 16:08 aqsyonas