Hi all,
I’m having an issue while designing the mapping property with null value for my JSON object. For example I have a Mapper to map $input to $body with the expression like follow:
{“my_id”: $input.Id,
“my_name”: $input.Name,
“my_address”: $input.Address
}.
When the $input is {“Id”: 123,“Name”: null, “Address”: “A Street, B District, C City”}, the $body should be: {“my_id”: 123,
“my_name”: null,
“my_address”: “A Street, B District, C City”
}. But when the $input is {“Id”: 123, “Address”: “A Street, B District, C City”}, the $body should be:
{“my_id”: $input.Id,
“my_address”: $input.Address
}. I tried with hasOwnProperty() and hasPath(), but they all treats the null value as not existing property, so it will not work.
Does anyone know how can I keep the null value for mapping, but eliminate property that does not exist in the $input. Thank you in advanced.
best regards.