Reference > Functions reference > JSON functions > JSONGetElement
 

JSONGetElement

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

Format 

JSONGetElement ( json ; keyOrIndexOrPath )

Parameters 

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 

FileMaker Pro 16.0

Description 

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

Notes 

This function is not supported in runtime solutions and returns "?".

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.

Related topics 

Functions reference (category list)

Functions reference (alphabetical list)

About formulas

About functions

Defining calculation fields

Using operators in formulas

Working with the JSON functions