Save and retrieve JSON variable


#1

Hi there,

I’m setting variables from my UI as (example):

“jsonData”: { “value”: “{…}”, “type”: “json”, “valueInfo”: {“serializationDataFormat”: “application/json”}

and sometimes I overwrite that result at my Java Delegation class as:

delegateExecution.setVariable(“jsonData”,
Variables.objectValue(jsonDataString).serializationDataFormat(“application/json”));

The problem starts when I try to retrieve that variable after setting it in Java, the response format is different. I’m using deserializeValues parameter for the calls. the first works with that set on “true” and the second with “false”.
Can you tell me the difference between those two methods, and how to make them even?

Thanks


#2

See the description in the api docs:
https://docs.camunda.org/manual/7.6/reference/rest/variable-instance/get/#query-parameters

The value is different depending on the true/false because its giving you a java-serialization rather than the deserialized value.

Why are you using a call with deserializeValue=true and another with false ?


#3

Don’t worry @StephenOTT,

I resolved it by using serialization with Spin rather than the previously mentioned method, and it worked like a charm.

Thanks.