Skip to main content

getInt (Function)

Function retrieves the int value specified in the given path of the JSON element.

Syntax

<INT> json:getInt(<STRING|OBJECT> json, <STRING> path)

Query Parameters

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
jsonThe JSON input containing int value.STRING OBJECTNoYes
pathThe JSON path to fetch the int value.STRINGNoYes

Example 1

json:getInt(json,'$.age')

If the json is the format {'name' : 'John', 'age' : 23}, then the function returns 23 as there is a matching int at $.age.

Example 2

json:getInt(json,'$.salary')

If the json is the format {'name' : 'John', 'age' : 23}, then the function returns null as there are no matching element at $.salary.

Example 3

json:getInt(json,'$.name')

If the json is the format {'name' : 'John', 'age' : 23}, then the function returns null as there are no matching int at $.name.