Forum Discussion

moizB's avatar
moizB
New Contributor
11 months ago
Solved

How to add an object into an array

Hi

I have the below JSON as input

[
{
"root": [
{
"id": "1",
"nodes": [

],
"parent": "0",
"tags": [
"Approved",
"1.0"
],
"text": "A"
}
]
},
{
"level2": {
"id": "2",
"nodes": [
{

}
],
"parent": "1",
"tags": [
"Approved",
"1.0"
],
"text": "B"
}
}
]

I want the output as

[
  {
    "root": [
      {
        "id": "1",
        "nodes": [
{
"id": "2",
"nodes": [{}],
"parent": "1",
"tags": [
"Approved",
"1.0"
],
"text": "B"
}
        ],
        "parent": "0",
        "tags": [
          "Approved",
          "1.0"
        ],
        "text": "A"
      }
    ]
  } 
]
Can anyone please help how this can be achieved?
  • Hello moizB,

    Please refer to the attached pipeline and let me know if it helps you in achieving the desired output structure.

     

    Regards,

    Aleksandar.

2 Replies

  • Hello moizB,

    Please refer to the attached pipeline and let me know if it helps you in achieving the desired output structure.

     

    Regards,

    Aleksandar.