Greetings. I have a data action that will return an array of objects. In some cases not all of the keys have a value set so the API will not return that key in the object. For example:
{
"results": [
{
"key1": 0000,
"key2": 111,
"key3": "2222222222",
"key4": "3333333333",
"key5": "44444",
"key6": "5555",
"key7": "66666"
},
{
"key1": 0000,
"key2": 11111,
"key3": "2222222222",
"key4": "3333333333",
"key5": "4444",
"key6": "55555"
}
]
}
As you can see in the second object the API just does not include the key, key7 in this case, if there is no value for it. I want to set up the translation map so that the data action will fill in a default value if a key is not present. What I would like to see is something like:
{
"results": [
{
"key1": 0000,
"key2": 111,
"key3": "2222222222",
"key4": "3333333333",
"key5": "44444",
"key6": "5555",
"key7": "66666"
},
{
"key1": 0000,
"key2": 11111,
"key3": "2222222222",
"key4": "3333333333",
"key5": "4444",
"key6": "55555",
"key7": "no value"
}
]
}
Currently the translation map is
{
"translationMap": {
"data": "$.*"
},
"translationMapDefaults": {},
"successTemplate": "{"results": ${data}}"
}
I have tried multiple variations to get the output like I have above but so far no luck. Any input is appreciated.
Thank you.