Json Parse method

i can’t seem to get the json Parse method working when using a variable.

I am trying to get the following output

“customfield_11401”: [
“value”: “1223-CUST-A1”

I am trying to use the following expression but getting an error. Any help is appreciated.

JSON.parse(’[{“value”: ‘+$dataCenterValue+’}]’)

Try this …

I would advise against constructing strings to pass to a parser since it’s easy to get escaping wrong. As mentioned in another reply, you can use the target path in the Mapper to write the field. Or, you can use literal syntax directly to construct arrays/objects, like so:

   "value": $dataCenterValue

You can then use a mapper to write that to $customfield_11401.

Thanks @tstack @Dheeraj . Both ways worked great for me.