JSON Parser
Block Group: | Table Operations |
Icon: |
The JSON Parser block converts a JSON string into a table. The output table can contain other tables within itself. For more information about nested tables, see How to View the Contents of Nested Tables.
This is a commonly used block, because many data-driven features in DGLux5, such as charts and repeaters, require tabular data.
The JSON Parser block is sometimes used to parse a string that has been loaded by a String Loader block.
For information on using dataflow blocks, see Dataflow.
For answers to some common questions about working with tables, see Tables.
Input/Output Properties
The following properties of the JSON Parser block can take input and give output.
- input (string)
- selector (string)
- drillDownDepth (integer)
- drillDownFilter (string)
- flatFilter (string)
input receives the JSON string. Sometimes it is the output from a String Loader block.
selector specifies the location of the data in the JSON string to parse into a table.
drillDownDepth specifies how far to drill down into the JSON when extracting data. Data below the drillDownDepth is not included in the output. The drillDownDepth property works only when a drillDownFilter or flatFilter is specified.
drillDownFilter specifies what to return for nested tables. Enter *
to return all nested tables to the specified drillDownDepth.
flatFilter specifies what to return for a flat table. Enter *
to return all data to the specified drillDownDepth, in a flat table.
Output Properties
The following properties of the JSON Parser block can give output but cannot take input.
- output (table)
- parseError (boolean)
output returns a table parsed from the JSON data.
parseError indicates whether the block encountered an error. An error might be caused by improperly formatted input.
Example
The following image shows, clockwise from top left:
- A String Loader block
- A JSON Parser block
- The output table of the JSON Parser block
- The JSON file