Working with Arrays & Objects from JSON Response

Describe the issue/error/question

I’m getting a response back from the Klaviyo API in the form of JSON. I’m having a lot of problems getting the info into a list to split it up and work on it.


[
{
"data":
[
{
"type":
"event",
"id":
"3Kb85guhGix",
"attributes":
{
"metric_id":
"Vy7Lc9",
"profile_id":
,
"timestamp":
1666894841,
"event_properties":
{
"form_id":
"VKzKRg",
"form_version_id":
7097509,
"form_type":
"POPUP",
"device_type":
"MOBILE",
"page_url":
"https://XXX/pages/hosting-at-home",
"$event_id":
"b744f044-78e6-4312-bf53-97604a89a500"
},
"datetime":
"2022-10-27 18:20:41+00:00",
"uuid":
"10432280-5624-11ed-8001-cd47d410ffc5"
},
"links":
{
"self":
"https://a.klaviyo.com/XXX/"
}
},
{
"type":
"event",
"id":
"3KbdNbZ3eu8",
"attributes":
{
"metric_id":
"TKFSFE",
"profile_id":
,
"timestamp":
1666894837,
"event_properties":
{
"form_id":
"VKzKRg",
"form_version_id":
7097509,
"form_type":
"POPUP",
"device_type":
"MOBILE",
"page_url":
"https://XXXpages/hosting-at-home",
"$event_id":
"dc8445f5-f3fe-445c-b36a-76dac1f71216"
},
"datetime":
"2022-10-27 18:20:37+00:00",
"uuid":
"0de0c880-5624-11ed-8001-32e2534897f3"
},
"links":
{
"self":
"https://a.klaviyo.com/XXX"
}
}, ...

I can’t use the list node and my Javascript isn’t good enough to figure out how to parse this separately. I’m sure it’s super simple, but I’m just missing something!

Hey @klitt,

Why can’t you use the list node? It looks like Data is an array so that should work. It looks like the json you have shred is incomplete though so it makes it tricky to see anything else.

What fields were you hoping to extract and use?

You’re entirely correct. instead of just using the plain text i was dragging the field into the list and it created the array. Absolute moron mistake. Thanks!

1 Like

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