How to convert json

I'm use json
obraz and it give me json like this

{
    "0": {
        "id": 1,
        "Address": 16401,
        "Name": "EE_Time_Cfg_i_TimeZoneOffset",
        "val": 0,
        "Default1": "60",
        "Unit": "min",
        "Description": "Przesuniecie czasu wzgledem UTC"
    },
    "1": {
        "id": 2,
        "Address": 16402,
        "Name": "EE_Time_Cfg_x_DST_Enable",
        "val": 0,
        "Default1": "1",
        "Unit": null,
        "Description": "Autoasu"
    },
    "2": {
        "id": 3,
        "Address": 16403,
        "Name": "EE_Time_Cfg_x_SNTP_Enable",
        "val": 0,
        "Default1": "0",
        "Unit": null,
        "Description": "Auttu"
    }
}

but I want like this

`[
  {
    "userId": 1,
    "id": 1,
    "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
    "body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
  },
  {
    "userId": 1,
    "id": 2,
    "title": "qui est esse",
    "body": "est rerum tempore vitae\nsequi sint nihil reprehenderit dolor beatae ea dolores neque\nfugiat blanditiis voluptate porro vel nihil molestiae ut reiciendis\nqui aperiam non debitis possimus qui neque nisi nulla"
  }
}
]

How to do that?

Where are you getting the data that goes to the json node? From looking at what you have and what you want, you are not inputing the correct data.

Indeed there is no obvious mapping from one to the other... but maybe a simple function node with

msg.payload = Object.values(msg.payload);
return msg;

will be close enough

1 Like

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