Json Parse method

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2019 04:45 PM
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+’}]’)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2019 05:41 PM
Try this …
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2019 07:27 AM
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
.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2019 09:08 AM
