Hi all,
Jumping one year into the future
We’ve got an API that is responding with a very awkward data structure. The structure cannot be changed by the API provider, so we have to manipulate it. The biggest problem is that the API is sending all values as arrays. This is creating challenges when trying to do basic tasks with this data, For example, filter “exist” will always return true (even if array is empty), length will return wrong values, etc. Another strange thing is that Make sees some of the empty arrays as "\r\n ".
Any ideas on how to elegantly manipulate this into a more workable data structure?
Here’s the response from the API:
You can see that it’s a collection of arrays.
I’ve attached a neutralized example below.
Thanks!
{
"LeadID": [
999
],
"CampaignID": [
9999
],
"Source": [
"site"
],
"Name": [
"\r\n "
],
"Phone": [
"9999"
],
"Email": [
"\r\n "
],
"Status": [
"\r\n "
],
"Remarks": [
"{\"Age\":\"\",\"Language\":\"\",\"Branch\":\"\",\"Question1\":\"\",\"Question2\":\"\",\"Question3\":\"\",\"Question4\":\"\",\"Question5\":\"\",\"UserFreestyleInput\":\"\",\"UserFreestyleTranslated\":\"\",\"DetectedLanguage\":\"\"}"
],
"Agent": [
"\r\n "
],
"Marketing": [
false
],
"InsertDate": [
"2/20/2023 2:02:42 PM"
],
"CallStatus": [
"\r\n "
],
"CallID": [
"0"
],
"Link": [
"https://www.999.com/"
],
"MoreDetails": [
"\r\n "
],
"RecordLink": [
"\r\n "
],
"GeneralSource": [
"\r\n "
],
"IPAddress": [
"9.9.9.9"
],
"FormName": [
"\r\n "
],
"CampaignName": [
"999"
]
}