User Tools

Site Tools


syntax:functions:jsonvalue

JSONValue(JSON_text, JSONPath)

Category: Web function

Description

This function extracts a single value or a JSON object/array from a node specified by JSONPath.


Arguments

ArgumentTypeDescription
JSON_text Text A string representing a JSON node.
JSONPath Text The value or JSON object/array to be returned.

Return value type: Any (The type of the value being returned.)


Remarks

If a result is a JSON array, it's stripped of the wrapping square brackets in order to make further splitting more convenient (e.g. using Split delimited text into columns or Split delimited text into rows).


Examples

jsonvalue('{"customer":{"ID":345}}', 'customer.ID')  //Returns 345 (Single scalar value)
jsonvalue('{"customer":{"ID":345, "name":"Plain Jane"}}', 'customer')
    //Returns '{"ID":345, "name":"Plain Jane"}' (JSON object)
jsonvalue('{"customerIDs":[345,346,347]}', 'customerIDs')
    //Returns '345,346,347' (JSON array stripped of brackets)


See also

syntax/functions/jsonvalue.txt · Last modified: 2021/09/18 20:21 by craigt