User Tools

Site Tools


syntax:functions:jsonvalue

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
syntax:functions:jsonvalue [2019/10/30 20:13]
dmitry
syntax:functions:jsonvalue [2021/09/18 20:21] (current)
craigt
Line 1: Line 1:
-=====jsonvalue(JSON_text, JSONPath)=====+======JSONValue(JSON_text, JSONPath) =====
 +Category:  Web function 
 +\\  
 +=====Description===== 
 +This function extracts a single value or a JSON object/array from a node specified by [[https://goessner.net/articles/JsonPath|JSONPath]].
  
-Extracts single value or JSON object/array from a node specified by [[https://goessner.net/articles/JsonPath|JSONPath]].+\\  
 +=====Arguments===== 
 +^Argument^Type^Description^ 
 +|JSON_text | Text |A string representing JSON node.  | 
 +|JSONPath  |Text |The value or JSON object/array to be returned | 
 +**Return value type:** Any (The type of the value being returned.)
  
-If a result is a JSON array it's stripped of the wrapping square brackets in order to make further splitting (e.g. using [[transformations:splitdelimitedtext|Split delimited text into columns]] or [[transformations:subfield|Split delimited text into rows]]) more convenient.+\\  
 +=====Remarks===== 
 +If a result is a JSON arrayit's stripped of the wrapping square brackets in order to make further splitting more convenient (e.g. using [[transformations:splitdelimitedtext|Split delimited text into columns]] or [[transformations:subfield|Split delimited text into rows]]).
  
-**Example** +\\  
- Expression ^  Result  ^ Note ^ +=====Examples===== 
-jsonvalue('{"customer":{"ID":345}}', 'customer.ID'  |  345Single scalar value +  jsonvalue('{"customer":{"ID":345}}', 'customer.ID')  //Returns 345 (Single scalar value)
-| jsonvalue('{"customer":{"ID":345, "name":"Plain Jane"}}', 'customer'  |{"ID":345, "name":"Plain Jane"} | JSON object | +
-| jsonvalue('{"customerIDs":[345,346,347]}', 'customerIDs'  |345,346,347 | JSON array stripped of brackets |+
  
-**See also**+  jsonvalue('{"customer":{"ID":345, "name":"Plain Jane"}}', 'customer'
 +      //Returns '{"ID":345, "name":"Plain Jane"}' (JSON object)
  
-  * [[syntax:functions:isjson]] +  jsonvalue('{"customerIDs":[345,346,347]}', 'customerIDs'
-  * [[syntax:functions:xmlvalue]]+      //Returns '345,346,347' (JSON array stripped of brackets) 
 + 
 +\\  
 +=====See also===== 
 +  * [[syntax:functions:isjson|IsJSON(text)]] 
 +  * [[syntax:functions:xmlvalue|XMLValue((XML_text, XPath)]]
syntax/functions/jsonvalue.txt · Last modified: 2021/09/18 20:21 by craigt