Hi,
I’ve implemented an HTTP task and I’m showing the JSON result in a form using an expression field. My problem is that I don’t know how to access the values instead of showing the whole response.
To see the respone I wrote ${myVar} where myVar is the name I placed in the field “Response varaible name” in HTTP task properties.
My tests where ${myVar}.total and ${myVar.total} but none worked.
Anyone knows if it’s possible to show only “total” value?
I think the response from API is stored as TEXT in the database. So you cannot directly access the key as its not JSON when you retrieve it from processVariable but a string. You can use something like
import org.flowable.engine.impl.util.json.JSONObject;
JSONObject response = new JSONObject(“String version of your processVariable”);
then do
response.getInt(“total”) to get the value of the total key.
You can expore all other methods to access data from response in JSONObject class.