Hi!
I need a little help to parse the following JSON.
I need to get the items inside the “body”, to use them in a set node. My webhook node is getting the following JSON exactly:
[
{
"headers": {
"host": "example.com",
"x-request-id": "k8d663a223bdd91d0f19caa846805b86",
"x-real-ip": "127.0.0.1",
"x-forwarded-for": "127.0.0.1",
"x-forwarded-host": "example.com",
"x-forwarded-port": "443",
"x-forwarded-proto": "https",
"x-forwarded-scheme": "https",
"x-scheme": "https",
"content-length": "2284",
"user-agent": "Faraday v1.10.2",
"accept-encoding": "gzip;q=1.0,deflate;q=0.6,identity;q=0.3",
"accept": "*/*",
"traceparent": "00-23bd54c49dab55094525e6b2daaa9642-4409c19693c4cfd0-00",
"tracestate": "2474923@nr=0-0-2474923-341290141-4409c19693c4cfd0-28f7288b05fcd95b-0-0.126801-1673392962875",
"newrelic": "jnJ2IjpbMCwxXSwiZCI6eyJ0eSI6IkFwcCIsImFjIjoiMjQ3NDkyMyIsImFwIjoiMzQxMjkwMTQxIiwidHgiOiIyOGY3Mjg4YjA1ZmNkOTViIiwidHIiOiIyM2JkNTRjNDlkYWI1NTA5NDUyNWU2YjJkYWFhOTY0MiIsInNhIjpmYWxzZSwicHIiOjAuMTI2ODAxLCJ0aSI6MTY3MzM5Mjk2Mjg3NSwiaWQiOiI0NDA5YzE5NjkzYzRjZmQwIn19",
"content-type": "application/x-www-form-urlencoded"
},
"params": {},
"query": {},
"body": {
"{\"quiz_name\":\"EXAMPLE TITLE - 11/01/2023\",\"quiz_id\":\"123\",\"response_id\":\"77Tz6xX8\",\"first_name\":\"John\",\"last_name\":\"Doe\",\"full_name\":\"Jon Doe\",\"email\":\"[email protected]\",\"emails\":[\"[email protected]\"],\"products\":[{\"name\":\"Some product name / 5 GB / Full Pack\",\"score\":1.091837,\"url\":\"https://example.com/path/something": "5 GB / Full Pack\\u0026attribute_example=ExampleAttribute\",\"price\":\"150.0\",\"price_with_currency\":\"150,00 USD\",\"image_url\":\"https://example.com/images/image.png\",\"position\":0,\"sku\":\"\",\"id\":14457,\"variant_id\":14462,\"description\":\"Product description\"}],\"blocks\":[{\"id\":\"yaToNJ8\",\"type\":\"HeadingBlock\",\"position\":0},{\"id\":\"4RTp729\",\"type\":\"ContentBlock\",\"position\":1},{\"id\":\"qoT7Z4N\",\"type\":\"ProductsBlock\",\"position\":2,\"products\":[{\"name\":\"Some product name / 5 GB / Full Pack\",\"id\":14457,\"url\":\"https://example.com/products/pack?attribute_size=ExampleAttribute\\u0026attribute_example=ExampleAttribute\",\"price\":\"150.0\",\"image_url\":\"https://example.com/images/image.png\",\"variant_id\":14462,\"position\":0,\"score\":1.091837,\"price_with_currency\":\"150,00 USD\"}]}],\"answers\":[{\"question_title\":\"Hello!↵↵\",\"question_id\":\"0MiVNYr\",\"values\":[\"Jon Doe\"]},{\"question_title\":\"Hello, {{slide:0MiVNYr}}\",\"question_id\":\"PjivGA7\",\"values\":[\"[email protected]\"]},{\"question_title\":\"Lets go. \",\"question_id\":\"bJizwe3\",\"choice_label\":\"Yes please \"},{\"question_title\":\"Ok.\",\"question_id\":\"1BiMNRn\",\"choice_label\":\"I'd like the cheapest option\"},{\"question_title\":\"¡Allright!\",\"question_id\":\"ZMiRjeR\",\"choice_label\":\"I want the full pack\"},{\"question_title\":\"¡Excellent!\",\"question_id\":\"8JiL9lb\",\"choice_label\":\"First category\"}],\"permalink\":\"https://example.com/#results-nmHB8aV-77Tz6xX8\",\"permalink_hash\":\"#results-nmHB8aV-77Tz6xX8\",\"created_at\":\"2023-01-10T23:22:41Z\"}"
}
}
]
In the SET node, I need to get the data individually (example: quiz_name, first_name, last_name, etc…)
I have already tried with {{JSON.parse($node[“Webhook”].json[“body”])[0].quiz_name}} and so on, but it gives me and [Object null] in the expression.
How should I get the values?
Thank you in advance!