Transformation for master…

How can I write the code in order to transform the following entry:

[
{
"headers": 
{
"connection": 
"close",
"host": 
"n8n.goliat2.synology.me",
"x-real-ip": 
"213.194.161.120",
"x-forwarded-for": 
"213.194.161.120",
"x-forwarded-proto": 
"https",
"content-length": 
"296",
"accept": 
"application/json, text/plain, */*",
"content-type": 
"application/x-www-form-urlencoded",
"user-agent": 
"axios/0.21.4"
},
"params": 
{
},
"query": 
{
},
"body": 
{
"{"type":"records.after.insert","id":"71e0a148-8c05-4e59-acd6-ff21a7c1a6f4","data":{"table_id":"mnipnur44c9wukw","table_name":"Cat","rows":[{"Id":6,"Title":"Az","CreatedAt":"2023-09-30 10:36:52 00:00","UpdatedAt":"2023-09-30 10:36:52 00:00","Fecha":null,"Edad":null,"Random":null,"Check":false}]}}": 
""
}
}
]

i need to extract only the rows that I have on the body section.

hi @MaaPer

Is everything ok with the json? As I see it has very strange key for the body part (quoted json as a key) and an empty value for that key.

you can extract it with the Set node like this:
{{ JSON.parse(Object.keys($json.body)[0]) }}

2 Likes

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