Hi all,
I have a process where I execute an HTTP task that uses a variable as the JSON body.
I just wanted to note that I’m only using the REST API for this.
When I start my process, I submit my variables. This is the variable array:
[{"name":"myJSONBody","value":{"first_field":"1","second_field":"2","last_field":"Hello World"}}]
As you can see, the variable is of type JSON and when I look up my variables I can see that it’s categorized as serializable:
{
"name": "myJSONBody",
"type": "serializable",
"value": null,
"valueUrl": "http://myurl/process-api/runtime/tasks/my-task-id/variables/myJSONBody/data",
"scope": "global"
}
Later on in the process, I use this variable for an HTTP task. The request body is like this:
{
"test_var": "${myJSONBody}"
}
Unfortunately, the JSON object from the variable myJSONBody now looks like this:
{first_field=1, second_field=2, last_field=Hello World}
Does anyone know why my JSON object gets transformed from this format:
"key": "value"
To this?
key=value
Is there any way to store my JSON object in a variable exactly as is without it being modified? If not, is there a function I can call in the HTTP Task request body that would convert this to be in the exact same format before? I’m trying to understand this behavior of why this is happening. As you can imagine, when this call is made, the body being submitted is incorrectly formatted and the API can’t understand the request body.
I tried reading some documentation from the link below, but it doesn’t go too far in depth of how serializable variables function:
https://flowable.com/open-source/docs/bpmn/ch15-REST/
Is it possible for me to have my variable be saved in the following format?
{"first_field":"1","second_field":"2","last_field":"Hello World"}
Any help would be greatly appreciated. Thank you guys in advance!