Hi,
I'm getting JSON data from an external source. However, the array of profile records that I'm getting isn't consistent. For example, some objects have the email key/value, some don't; some objects have the phone key/value, some don't. When I try mapping this to my Add Records step, I keep getting an error whenever the loop iterates over a profile where some key(s) don't exist. What approach should I use so that the corresponding fields in the DB are set to null if the key doesn't exist?
[ { 'name': 'John', 'email': '[email protected]', 'phone': '5551237890' }, 'name': 'Tracy', 'phone': '5551237890' { 'name': 'Tim', 'email': '[email protected]' }, { 'name': 'Steve' } ]
I could do the keys filter for each profile object and then check using the in filter if email exists, if phone exists, etc. one check for each key that I expect but that seems to be extremely inefficient as every profile object has 50+ keys. I'm sure there's a better way to do this but I can't figure out how. Any help is much appreciated.
Thank you.