cancel
Showing results for 
Search instead for 
Did you mean: 

Workato format_map issue: null returned as string instead of JSON null

shaked
Deputy Chef I
Deputy Chef I

 

I’m working with a dynamic list in Workato and building a JSON string using format_map.

My current formula looks like this:

='{' +
( _dp('...ResponseBody...') == null ? '' :
_dp('...ResponseBody...').format_map('"%{Key}":"%{Value}"').join(',')
) +
'}'
The issue is that when the value is null, the output becomes:
{"data":"null"}
However, I need it to be valid JSON, like this:
{"data":null}
In addition, I need proper type handling:
  • Strings should be wrapped in quotes
  • Numbers and booleans should not be wrapped in quotes
  • Null values should be actual JSON null (without quotes)

Is there a recommended way in Workato to handle this type-aware formatting inside format_map, or any other approach to correctly build a valid JSON object from a dynamic list?

0 REPLIES 0