JSON Path

Introduction

In operators whose data schema is in JSON format, you must edit the operator’s schema.

The Edit Schema window opens when you click Edit Output Schema (edit_schema) in the Properties pane of those operators. You can reorder, add, and remove attributes from the data schema as it flows between operators.

In the Edit Schema window, JSON Path is a path according to the JSON Pointer specification. It defines a string syntax for identifying a specific value within a JSON.

JSON path in Edit Schema window

The following code snippet is an example JSON document.

	{  
		"title": "Some Book",
		"publisher": {
    		"name": "Wiki"
  		},  
  		"authors": [
    		{ "names": ["Smith", "John"] },
    		{ "names": ["Doe", "Jane"] }
  		 ]
	} 

The JSON Path defines a string syntax that is prefixed by ‘/’. The path is used to identify a specific value within a JSON document.

Using the example JSON document, the following code snippet shows what the JSON Path is to extract values.

/title                  "Some Book"
/publisher/name         "Wiki"
/authors/0/names/0      "Smith"
/authors/0/names/1      "John"
/authors/1/names/1      "Jane"
/authors/1/names/42     ""  (this is an empty value, not an error) 

Learn more