Feel expression

Hi,

I am getting the connector response in string format of third party API so, how can I convert that string response to json object in feel expression?

I can’t force the client to change the requirement/ update the API based on our need right?

TIA

Hi @yadav1990 - I don’t think there’s a direct way to convert a string to a context (which is what JSON-like objects are called in FEEL). You might be able to use the substring function to build a context, but that feels fragile to me.

I’m not sure the answer to your second question. If the API is programmed to respond with a string value rather than JSON, then the API itself needs to be changed in order to change the response. Another option would be to create your own Connector that converts the API response to an object before sending the response to the process engine. Java (and Node and Python) have much more powerful methods for converting data than FEEL!

1 Like

Hi @yadav1990,

I’ve created a JSON value for a local variable from other existing variables with an input mapping like this:

grafik

Hope this helps, Ingo

thanks for trying but it’s what I am looking.

exactly to the second point @nathan.loding the API itself returning in string with escape character and getting consumed by 100’s of customer so I can’t force them to change for me.

Also, I don’t want to write the code and introduce multiple connector just for parsing the different responses.

Are you able to share the string and an example of the object shape you’d like to see it in?