Going Stellar

Home/Smart values reference

Jira Automation smart value

asJsonObject() and JSON parsing in Jira Automation

asJsonObject(key) wraps a value in a JSON object with the key you choose. asJsonObjectArray(key) copies one property of every object in a list. jsonStringToObject() and xmlToJson() go the other way: they turn JSON or XML text into an object whose keys you read with a dot.

Syntax

{{text.asJsonObject("keyName")}}
{{list.asJsonObjectArray("keyName")}}
{{jsonStringToObject(text)}}
{{xmlToJson(xmlString)}}

Arguments

ArgumentWhat it isRequired
keyNameThe name of the key in the resulting JSON object, in double quotes. asJsonObjectArray() can only copy the key of the property it reads.yes
text / xmlStringThe JSON or XML text to parse, such as the body of a web response.yes

Works on

  • Fields: text values and lists for the as functions; any smart value that holds JSON or XML text for the parsers.
  • Returns: a JSON object or array written as text, or a parsed object.

Examples

{{issue.summary.asJsonObject("title")}}

Wrap the summary in an object with a key of your choice.

Result:

{ "title": "Hello World!" }

Run on Jira Cloud on .

{{issue.labels.first.asJsonObject("label")}}

The same for the first label, to send it under the key an API expects.

Result:

{ "label": "checkout" }

Run on Jira Cloud on .

{{issue.labels.asJsonObject("label").asJsonArray}}

Chain asJsonArray after asJsonObject on a list to get a proper JSON array of objects.

Result:

[{ "label": "checkout" },{ "label": "demo" }]

Run on Jira Cloud on .

{{issue.comments.asJsonObjectArray("body")}}

Extract only the body of every comment as an array of objects.

Result:

[{ "body": "First comment from QA" },{ "body": "Second comment: fixed in build 42" }]

Run on Jira Cloud on .

{{jsonStringToObject("{\"value\": \"Hi\"}").value}}

Parse a JSON text and read one key with a dot.

Result:

Hi

Run on Jira Cloud on .

{{jsonStringToObject("{\"value\": \"Hi\"}")}}

Without a key the parsed object prints as key=value.

Result:

{value=Hi}

Run on Jira Cloud on .

Pitfalls

  • asJsonObject on a list prints the objects separated by a comma, without brackets: { "label": "checkout" }, { "label": "demo" }. Add .asJsonArray to get a valid array (checked on Jira Cloud, November 2026).
  • asJsonArray on a single object, such as issue.summary.asJsonObject("title"), renders an empty string. It expects a list.
  • jsonStringToObject() fails on text that is not JSON. A description such as Checkout page redesign gives Failed to convert string to JSON. Error: Unrecognized token 'Checkout' and the rule logs an error.
  • webResponse.body exists only after a Send web request action. Without one, both parsers fail, as the two examples taken from the Atlassian page show.

Sources

  1. Jira smart values: JSON functions (Atlassian Support)

Markdown version · All smart values