cancel
Showing results for 
Search instead for 
Did you mean: 

How to add an object into an array

moizB
New Contributor

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?
1 ACCEPTED SOLUTION

Aleksandar_A
Contributor III

Hello @moizB,

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

 

Regards,

Aleksandar.

View solution in original post

2 REPLIES 2

Aleksandar_A
Contributor III

Hello @moizB,

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

 

Regards,

Aleksandar.

moizB
New Contributor

Thanks @Aleksandar_A ! That is exactly what I was looking for