Tabular Fields and the JSON content type

When a tabular field is set to the JSON content type, EasyCatalog automatically converts the JSON field content into a tabular field. Certain assumptions are made based on the structure of the JSON:

  • For an array of objects, each object is as a row and the properties are columns.
  • For an array of values, each value is a row.
  • For an object, each property is a row.

The JSONPath parameter can be used to return data from a specific point in the Hierarchy. If the JSONPath is prefixed with + the JSON is returned in flat structure.

Examples

Here are examples of the different types:

Array of objects:

Array of values:

Object:

Named Object Property:

In this case we need to use the JSONPath parameter to target the property “Total Light Output”. The syntax for this is:

$.’Total Light Output’

Which gives the result:

Notice the values in the second row are JSON arrays. Tto turn these into something more useable, they can be processed by post processing them using the jsonarraytostring command:

Which gives:

Working with Flattened JSON

If JSONPath starts with +, or just + is entered in the JSONPath field the JSON is flattened. Using the example above, the table now looks like:

Breaking Out Specific Content

JSONPath can be used to extract specific values from the JSON into custom fields. In the above example, ‘address’ contains additional JSON. Creating an Advanced custom field with the command

Will extract the ‘address’ JSON using JSONPath, which then can be set to content type JSON.

.