โ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