How can I add JSON highlighting to the code in Jira comment?

Is it possible to add a highlighted code to Jira comment? I want to write something like this:


The comment text and JSON doc:

{
  "key": 100
}

I've found only one example:

{code:javascript}
{
  "key": 100
}
{code}

But it does not really highlight my code. I see only the grey block.


Solution 1:

You can try to add only {code} at the beginning and end of your code block.

Example:

{code}
{
  "key": 100
}
{code}

Solution 2:

Recent Jira 7.5+ starts supporting more languages, including JSON.

Simply use:

{code:json}
...
{code}

See syntax highlighting in https://confluence.atlassian.com/jirasoftware/jira-software-7-5-x-release-notes-934719297.html#JIRASoftware7.5.xreleasenotes-tweaksMoreimprovements.

See documentation: https://jira.atlassian.com/secure/WikiRendererHelpAction.jspa?section=all

The default language is Java but you can specify others too, including ActionScript, Ada, AppleScript, bash, C, C#, C++, CSS, Erlang, Go, Groovy, Haskell, HTML, JavaScript, JSON, Lua, Nyan, Objc, Perl, PHP, Python, R, Ruby, Scala, SQL, Swift, VisualBasic, XML and YAML.