10-09-2018 09:05 AM
Hello, Below is the JSON output from a REST API source. I am trying to flatten the hierarchical JSON structure using the splitter snap. I am able to flatten “meals” attribute, but unable to split the “credentials”. The expected output should be all the attributes should be column names.
{
“object”: “list”,
“data”: [
{
“id”: “locid”,
“object”: “locname”,
“group_id”: “grp_id”,
“name”: “name1”,
“active”: 1,
“count”: 2,
“timezone”: “xxxx”,
“week_end”: “Wednesday”,
“sales_tax”: 0.0825,
“schedule_start”: “”,
“schedule_stop”: “”,
“type”: “xxxx”,
“meals”: [
{
“name”: “breakfast”,
“end”: “10:30”
},
{
“name”: “lunch”,
“end”: “15:00”
}
],
“credentials”: {
“str_id”: “999999”,
“str_id_2”: “2222”
}
}
Solved! Go to Solution.
10-16-2018 02:46 PM
You’ll need to add some element to the meal list when it’s empty in order to get the splitter to do anything. Maybe add an empty object (i.e. {}
) or null
.
10-09-2018 09:55 AM
You can use a Structure snap to flatten a JSON object. You can’t use Splitter on credentials because it’s not an array.
10-09-2018 10:11 AM
I tried the structure snap and is giving me the same result where i am not able to split the “credentials” as it is not an array. Not sure what i am doing wrong.
10-09-2018 10:12 AM
Did you look at my example?
10-09-2018 10:14 AM
Sorry. I just saw your reply with example. Will go through it and get back to you. Thanks