Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to parse JSON and match specific values out

Gilad Waldman
Contributor
September 4, 2025

Hello, I have a field that is populated with multiple platform versions :

{ "Browser": ["1.2.3", "1.23.0"], "Extension": ["1.8.6p"], "Protect": ["1.98.4p", "1.98.4p", "1.98.4p"], "SSH": ["1.87.0"] }

Am trying to build an automation rule that parse the text and brake it into different fields like this:

Browser ->  ["1.2.3", "1.23.0"]

Extension -> ["1.8.6p"]

I first tried to use this smart value : {{ issue.customfield_10582.asJson."Browser"}}

but i get nothing, so was trying to use asJsonObject but still can match.

any ideas?

3 answers

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 4, 2025

Hi @Gilad Waldman 

Please try using the function jsonStringToObject() to convert the plain text to JSON which can access the elements with dot-notation:

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#jsonStringToObject--

 

Kind regards,
Bill

0 votes
Marc - Devoteam
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 4, 2025

Hi @Gilad Waldman 

You will have to use smart values, based on text options.

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/ 

Then create a variable and use the smart value: {{issue.customfield_10582.substringBetween("[","]")}}

Then log this as well and see what you get as result.

With an edit action set the field based on the variable.

Gilad Waldman
Contributor
September 4, 2025

Wondering why... this should JSON should be easier to extract data from.

Marc - Devoteam
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 4, 2025

Hi @Gilad Waldman 

Then you need to set the options as an array.

{{issue.customfield_10582.asJsonStringArray}}

See https://support.atlassian.com/cloud-automation/docs/jira-smart-values-json-functions/ 

Gilad Waldman
Contributor
September 4, 2025

familiar with the documentation, thanks. its just keeps returning empty value

Gilad Waldman
Contributor
September 4, 2025

for example, if i use 

asJsonObject: {{issue.customfield_10582.asJsonObject("Browser")}}

I'm expecting to get the values ["1.2.3", "1.23.0"] but instead im getting: 

{ "Browser": "{\"Browser\": [\"1.2.3\", \"1.23.0\"],\"Extension\": [\"1.8.6p\"],\"Protect\": [\"1.98.4p\", \"1.98.4p\", \"1.98.4p\",\"1.1.1\"],\"SSH\": [\"1.87.0\"]} " }

Marc - Devoteam
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 4, 2025

Hi @Gilad Waldman 

What do you get on using {{issue.customfield_10582.asJsonStringArray}}

What you expect is not right, as the values you are trying to fetch in a single field, so you get everything.

You will 1st need to get the values in an array and from the array use the values you want to place in the respective fields.

Gilad Waldman
Contributor
September 4, 2025

Ok that helps, im just not sure why it doesnt allow me to break it into an array

When I'm using asJsonStringArray Im not getting back any value

Only if I'm trying to use asJsonObject as seen above 

Marc - Devoteam
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 4, 2025

Hi @Gilad Waldman 

As mentioned before the information you have is text, so you need to split this content, you can use the text smart value options for this.

See this form post on why setting text as as json object is hard and iratic.

https://community.atlassian.com/forums/Jira-questions/Parsing-a-text-field-with-a-JSON-object/qaq-p/2260884 

0 votes
Yash Smith September 4, 2025

Can you please explain in detail?

Gilad Waldman
Contributor
September 4, 2025

explain what exactly? 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events