About output mapping, how to merge variables, not overwrite

I start a workflow instance with variable {“Service_01”: {“a”: 1, “b”:{“c”: 3, “d”: 4}}}, set a ioMapping
image

when the job worker compelete this job and set d = “d4”, output mapping overwrite the variable.

I expected the result is : {“Service_01”: {“a”: 1, “b”:{“c”: 3, “d”: “d4”}}}
but actually i get : {“Service_01”: {“b”:{“d”: “d4”}}}

How can i change output mapping behavior?

Variables are faux JSON.

They are key:value pairs.

Deep JSON structures are stored as stringified JSON. Any assignment to a top-level key is a replacement of the entire value - deep assignments are implicitly assignment to the key.

Arguably, this behaviour is counter-intuitive when assigning to a deeply-nested property. Feel free to open a GitHub issue with a Feature Request, and post a link here for others to add their input.

1 Like

@jwulf
Thanks! I got it.

Hi @lkestk,

This sounds like a bug, we fixed in 0.22.2. (https://github.com/zeebe-io/zeebe/issues/3621). Please try again with a version >= 0.22.2.

Best regards,
Philipp

1 Like

Hi @philipp.ossler
I have try version 0.22.2 , it works.
Thanks!

1 Like