JSON Table macro - Cloud

JSON Table macro - Cloud

Overview

JSON (JavaScript Object Notation) has become a highly used interchange format because it is lightweight, simple, and easy to read and write. Many REST APIs, including Atlassian REST APIs, return JSON format which makes it ideal for scripting output. 

The JSON Table macro can import, format, and display JSON data from anywhere, by:

  • Reading the JSON data from either of these sources:

    • Within your Confluence page.

    • From a page attachment in the same or different space.

  • Allowing customizable access to fields.

  • Supporting inclusion of wiki markup macros within the JSON data.

  • Leveraging the same table styling capabilities as the Table Plus macro.

This macro supports certain common table capabilities with the other macros in this app and also other Bob Swift Atlassian apps.

Basic use

This macro can be added to a page using any of the following methods:

Selected from the macro browser

Advanced Tables - JSON Table

Markup shortcut (Old editor)

{json-table}

Markup shortcut (New editor - case insensitive)

/JSON Table

Parameters

Parameters removed

  • The URL user and URL user password parameters have been removed from the JSON Table macro.

  • Use a profile to access the data from a remote location.

Macro specific parameters

Macro Editor Label

Default

Description

Macro Parameter

Macro Editor Label

Default

Description

Macro Parameter

Paths to fields

 

Specify a single path to generate a single table. Simple form is a dot separated list of field names to reach the specific field within the JSON string. Example: total.monthlies.

When a comma separated list of paths to fields is provided, a table is produced for each valid field identified in the path. No table is produced for references to fields that cannot be found, are empty arrays, or similar.

Paths are expressed in JSONPath syntax.

paths

Paths to fields to be included

all fields

Enter a comma separated list of paths to fields to be included in the output. Paths are relative to the JSON field specified in the paths parameter. If not specified, all fields found are included.

Example for the issues field from the Jira search REST API:
key, fields.summary, fields.issuetype.namefields.issuetype.id, fields.fixVersions[*].name

fieldPaths

Regex patterns for ordering fields

 

Enter a comma separated list of regular expression (regex) patterns.

This parameter is used only when the Paths to fields to be included field defaults to all fields; otherwise, the order specified in Paths to fields to be included is used.

Useful when multiple tables are generated and column ordering is not ideal. Field order is not specific in JSON strings so when field order is important, these regex patterns can be used to control the order. 

A field found by an earlier pattern is processed before fields not found or fields found by a later pattern.

fieldOrderRegexPatterns

Paths to be used to determine sort order

 

Enter a comma separated list of path references to fields (simple only) to be used to determine how rows are initially sorted.

Paths are relative to the JSON field specified in the Paths to fields parameter. If specified, JSON array elements are sorted based on the comparison of field values represented by the paths. The first path is the primary sort value. Subsequent paths are used only if the first comparison is equal. The sort direction is ascending unless Sort descending is selected. This sorting is done before the HTML is generated for display.

sortPaths

Strip leading qualifiers from generated headings

false

Enable to make table heading columns look better by stripping leading qualifiers (using a dot separator (.)) for names generated as a result of Paths to fields to be included. For example, field.type would be converted to type.

stripQualifiers

Capitalize first character of generated headings

true

Enable to make table heading columns look better by capitalizing leading character of names generated as a result of Paths to fields to be included.

capitalize

Output format

html

Specify how the output is formatted. The options are as follows:

  • html - data is entered as standard HTML directly in the macro body.

  • wiki - data in the table rendered using the wiki renderer.

output

Location of JSON data

macro body

Specifies the list of options where JSON data is located. The included data follows the body data based on the location selected. The possible options are:

  • blank - Data is read from the contents in the macro body.

  • ^attachment - Data is read from an attachment that is available on the current page.

  • page^attachment - Data is read from an attachment available on the specified page in the current space.

  • space:page^attachment - Data is read from an attachment available on the specified page in a different space.

location

Profile

 

Enter the profile name from the list of pre-configured profiles. Contact your administrator to know about the profiles available for your use. Refer to the Configuration documentation to learn more about profile configuration.

profile

URL to JSON data

 

Enter the URL containing the required JSON that are to be processed and rendered. If specified, the included data follows the body and script data.

url

URL connection timeout (milliseconds)

 

Enter time in milliseconds such that URL connections do not timeout before getting data. Use this to increase time needed for slow connections. Note that if a zero is given the connection may wait infinitely.

timeout

Augments to data row values

 

Enter a comma separated list of augments to the data row values, one for each column. Specify double quotes for values with a comma. See Augments for details.

augments

Augments to heading row values

 

Enter a comma separated list of augments to heading row values, one for each column. See Augments for details.

headingAugments

Augments to footing row values

 

Enter a comma separated list of augments to footing row values, one for each column. See Augments for details.

footingAugments

Show wiki

false

Enable this option to show a non-formatted version of the wiki table following the formatted table. This is used to help resolve formatting issues. It can also be used to convert CSV to Confluence markup by cut and paste.

showWiki

Escape special characters in wiki markup

false

Enable this option to allow few special characters to be escaped so that the formatting is unaffected. When wiki output is requested (Output format is set to wiki), some special characters (like '|', '[', ']', '{', '}') in data can cause undesirable formatting of the table. By default, data that has wiki markup is  rendered correctly.

escape

File encoding

System default

Specify the encoding for an external file, if different from the Confluence default (like Windows-1252, UTF-8, MacRoman). Refer to this article for more information. Example: UTF-8.

encoding

Render wiki markup macros in body

false

Enable this option to render wiki markup macros found in the body prior to processing as CSV. This is useful to run macros from apps such as Scripting for ConfluenceRun CLI Actions in ConfluenceSQL for Confluence, or similar, that can produce CSV output.

macros

Common parameters

Examples

Other macros

Below is a list of all other macros available within this app:

Additional references

Need support? Create a request with our support team.

Copyright © 2005 - 2025 Appfire | All rights reserved.