'Passing in empty string breaks Input Transformer if I want to enforce double quotes on all values

This is my very simple scenario. I'm passing in a JSON to an Input Transformer within EventBridge, and I'd like for the output template to be a transformed JSON where all values are strings. The input paths are fairly standard, nothing special.

In the template however, in order to enforce the above scenario, I define all the mappings as such:

{
   "zip" : "<userZip>"
}

That works fine if the input JSON is either 1) a string already, or 2) an integer. However, if I pass in an empty string, I believe the input transformer itself fails, and will not send the result to a target and instead return a FailedInvocation error. I cannot guarantee that the value from the input JSON will always be populated with a value.

How would I go about configuring input transformer to enforce that every mapped value is a string?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source