Skip to main content
Version: Next

Get From Json

Extracts object or primitive from JSON by specified path

Description

Extracts a JSON and extracts the object specified by the property path.

The path is specified in dotted form. To extract an element inside an array, the property needs to be included inside brackets, e.g. '[name]'.

Examples

GetFromJSON({ "a": { "b": "hello"}}, 'a.b') -> "hello"
GetFromJSON({ "a": [ { "b": "hello", "c": "boo 1" }, { "b": "coucou" , "c": "boo 2" }] } , 'a.[b]') -> ["hello","coucou"]
GetFromJSON({ "a": [ { "b": { "c": "boo 1" } }, { "b": { "c": "boo 2" } } ] } , 'a.[b].c') -> ["boo 1","boo 2"]

Full doc of the syntax supported: <a href="https://www.npmjs.com/package/jsonpath-plus" target="_blank">jsonpath-plus</a>.

A list will be returned having multiple results found.

If path was not found the result would be null and Error Flow would be triggered.

Inputs

  • Control Flow (Control Flow)
  • Source (Object): The JSON object or string
  • Path (String): The path to element by properties

Outputs

  • Control Flow (Control Flow)
  • Error Flow (Error Flow): Trigerred by providing incorrect json
  • Result (Object): The resulting object or primitive