$customHeader
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Summary

Sometimes there are Custom Fields that will return a JSON value

Converting a Custom Field value into a JSON value

When we gather the value from the Custom Field it will be returned as a String value which means that it is currently not possible to manipulate the JSON data. To be able to access the JSON data you will need to use the following command to convert the Text value into a JSON value.

$jemhUtils.createJSONFromSource(String jsonSource)

Using this with a Custom Field value

$jemhUtils.createJSONFromSource($issue.getCustomFieldValue("customfield_10233"))

Extracting a Specific Object value

To extract a specific Object value you will simply need to add the object name to the above .e.g

$jemhUtils.createJSONFromSource($issue.getCustomFieldValue("customfield_10233")).object

You can then also add the next object to return that value by again adding the object name to the end. e.g.

$jemhUtils.createJSONFromSource($issue.getCustomFieldValue("customfield_10233")).object.name

Extracting a specific value from a JSON Array

Sometimes the JSON object may contain an array for a specific object. To access the array value you must specify the Array to get the value by using .get() and then specifying the Array number e.g. below will return the id that is found within first array in the list.

$jemhUtils.createJSONFromSource($issue.getCustomFieldValue("customfield_10233")).object.array.get(0).id

Extracting a specific value from all JSON Array’s

  • No labels