Help with Nested Json Format

I was working with a workflow to send data from QuestDB to an endpoint and the endpoint requires a certain format which is for eg:

Output
{
"Inputs": {
  "myArray": [
    {
      "version": 5,
      "permissionMask": 1
    },
    {
      "version": 126,
      "permissionMask": 1
    }
  ]
}
}


But after doing all merge and Item split node with operation as Aggregate items, I get data as follows:

Output
{
  "myArray": [
    {
      "version": 5,
      "permissionMask": 1
    },
    {
      "version": 126,
      "permissionMask": 1
    }
  ]
}

Could you give a suggestion what should be done to get the former format which is acceptable by the endpoint.

Hi @Meghna_jose

You could use the set node with a field “Inputs” and value of your second output. That would nest it back into “Inputs”.

Hi @BramKn ,
Thanks for your response, I had tried that earlier, but that just replaces the previous field name.

Ah yes of course.
try this in second set:

$json

so without the fieldname of the first Set.

2 Likes

Thanks a lot @BramKn , it works.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.