Queries JSON data for an element specified by an object name, an array index, or a path.


JSONGetElement ( json ; keyOrIndexOrPath )


json - any text expression or field that contains a JSON object or array.

keyOrIndexOrPath - any text expression or field that specifies a JSON object name (key), an array index, or a path. See Working with the JSON functions.

Data type returned 

text, number

Originated in version 



If the JSON value at keyOrIndexOrPath is a number or a Boolean, this function returns a number; otherwise, it returns text.

Example 1 

JSONGetElement ( "{ \"a\" : 11, \"b\" : 22, \"c\" : 33 }" ; "b" ) returns 22 as a number.

Example 2 

JSONGetElement ( "[ true, false, true ]" ; 1 ) returns 0 (false) as a number.

Example 3 

From the Example JSON data stored in the $$JSON variable, gets the value of the "name" object of the second "product" object in the array.

JSONGetElement ( $$JSON ; "bakery.product[1]name" ) returns Chocolate Cake as text.

Example 4 

If the $$JSON variable is set to

                "product.id" : "FB1",
                "product.name" : "Donuts",
                "price": 1.99,
                "stock" : 43,
                "product.category" : "Breads",
                "special" : true

then JSONGetElement ( $$JSON ; "['bakery']['product'][0]['product.name']" ) returns Donuts as text, which is the value of the "product.name" key in the first "product" object in the array. Because the key name includes a period, the keyOrIndexOrPath parameter is written in bracket notation.