Hi,
From the previous node i have input like this
[{
"headers": {
"host": "103.238.223.37:2291",
"authorization": "YOUR_AUTHORIZATION_HEADER_VALUE",
"content-type": "application/json",
"content-length": "76",
"connection": "keep-alive",
"user-agent": "Mozilla/5.0 (compatible; Google-Apps-Script; beanserver; +https://script.google.com; id: UAEmdDd-fL_wkg6pEpZPd2o6ECH4LrJRmTg)",
"accept-encoding": "gzip, deflate, br"
},
"params": {},
"query": {},
"body": {
"row": 6,
"values": ["2023-06-06T10:09:59.867Z", "testing", "delhi"]
}
}]
and want to map the field of the next node like this
[
{ "q": 0, "a": "2023-06-06T10:09:59.867Z" },
{ "q": 1, "a": "testing" },
{ "q": 2, "a": "delhi" }
]
as i want to insert this newly created array into my database. So I am unable to modify the input array to the later one. I have tried this but not working, giving syntax error.
{{ $json.body.values.map((a, q) => ({ ques: q, ans: a })) }}
And tried this and its giving empty object [Object: null]
{{ $json.body.values.map(function(a, q){ return { ques: q, ans: a } }) }}
Please suggest.
Thanks