Skip to main content

getFloat (Function)

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

Syntax

<FLOAT> json:getFloat(<STRING|OBJECT> json, <STRING> path)

Query Parameters

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

Example 1

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

If the json is the format {'name' : 'John', 'salary' : 12000.0}, th function returns 12000 as there is a matching float at $.salary.

Example 2

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

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

Example 3

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

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