Using GETKEYVALUE function

When you need to get only the value from a specific key you need to use the GETKEYVALUE function.

Syntax

GETKEYVALUE(object, “keyname”)

Where,

  • object: is the JSON object from where the value is to be fetch
  • Keyname: is the default key name or label of the JSON object

Let us consider an example here where you want to fetch data from a JSON column of a Sheet and display it in a text control.

Typically to fetch data we would use the LOOKUP function which would be written as shown in the example below and the output would have the Header Labels for each array of JSON objects as per the key in the JSON.

LOOKUP([Prod_depend_Doc.json_object] , Prod_depend_Doc.unique_id = 1))

So now that you want to bind the Name key to the text control, you need to fetch the value of the name key using the GETKEYVALUE() function as follows:

GETKEYVALUE( STRINGTOJSON( LOOKUP([Prod_depend_Doc.json_object] , Prod_depend_Doc.unique_id = 1)) , “name”)

Which will return the value in the “name” key i.e. John in this case.

So now when you run the form it would be fetched in the Text control for Name as seen below. If you do not use the GETKEYVALUE function the text control would only show output as “Object Object” as the text control is not able to fetch the value from the JSON object.