JMESPath expression - j5 - 30 - Administration & Configuration - Hexagon

j5 IndustraForm Designer Reference

Language
English
Product
j5
Search by Category
Administration & Configuration
j5 Version
30

An IndustraForm can only display JSON data that is in tabular form, but many JSON objects contain nested results or other formatting. To use non-tabular JSON data, you can use a jmespath_expression.

A jmespath_expression can be passed as the third input to the IMPORT.JSON function. You can use any JMES expressions (https://jmespath.org/) to convert the JSON response into tabular form so that it can be used in an IndustraForm.

For example, this URL returns JSON data: https://7timer.info/bin/astro.php?lon=34&lat=-23&ac=0&unit=metric&output=json&tzshift=2

This JSON data has three keys: product, init, and dataseries. The dataseries key contains tabular data we want to use.

5JSON data

The formula to retrieve the data looks like this:

=IMPORT.JSON("https://7timer.info/bin/astro.php?lon=${lon}&lat=${lat}&ac=${ac}&unit=${unit}&output=${output}&tzshift=${tzshift}",

{

"lon", 34;

"lat", -23;

"ac", 0;

"unit", "metric";

"output", "json";

"tzshift", 2},

"dataseries")

In this case, the JMESPath dataseries is all that is needed to retrieve the tabular data. More complex expressions can be written to extract tabular data from other more complex JSON structures.