Need a json response from an externally callable object function
I have set the visibility of an object function to 'Callable By External Systems' and return type as String (as Object, List, Map is not supported).
Inside the object function I need to return a json object to the source where it is being called.
Currently I am returning a map as shown below
def response = [ status : "error", message: e.message ]
return response
At the source, I am getting a response like this,
{ "result": "{status=error, message=api failed}"}
I have been tryign an alternative to return an exact json object or string to the source.
Requirement : Need to return a json response to source from Fusion CRM application containing some records data that we want to send.