JSON

1. JPARSE

Deserializes the specified JSON string into object or array.

JPARSE(json_string, separator_optional)

Replace:

json_string parameter with a JSON format string you need to parse;

separator_optional optional parameter to make function convert string to array by splitting it.

2. JPARSEXML

Deserializes the specified XML string into object.

JPARSEXML(xml_string)

Replace xml_string parameter with a string (in XML format) you need to parse.

3. JOBJECT

Builds an object from provided key names and values.

JOBJECT(key1, value1, key2, value2, ...)

Replace:

key1, key2 parameters with strings that are key names

value1, value2 parameters with strings that are key values

If omit some value, it will be stored as null.

circle-info

Object values depend on data passed to the function:

  • blank space and null will give null value

  • logical expression and true will give true value. False is got in the same way.

  • if value is numeric (or has numeric result of calculation), it will be given as a number, without quotes.

  • to make empty string value, pass ''.

  • to make a nested object, call JOBJECT function in the proper place.

circle-exclamation

4. JSTRING

Serializes objects into JSON string.

JSTRING(json_object)

Replace json_object parameter with an object you need to convert into string.

5. JGET

Gets a value from JSON content using a path provided.

JGET(json_object, path)

Replace:

json_object parameter with an object you want to use;

path parameter with the path to find a field in the object (or pass index for arrays).

6. JPUT

Puts a value into JSON content using a path provided.

JPUT(json_object, path, value)

Replace:

json_object parameter with an object you want to use;

path parameter with the path to find a field in the object to update;

value parameter with the value a field will be updated with.

circle-info

You can also pass index as a path if you operate with an array.

If value needs to be added as a last element of an array pass -1 as a path.

7. JREMOVE

Removes a field from JSON content using a path provided.

JREMOVE(json_object, key_or_jsonobject)

Replace:

json_object parameter with an object you want to use;

key_or_jsonobject parameter with the key to find a field you need to remove or with array element to be removed from JSON array.

circle-info

If you need to remove multiple values from object you can pass array of object keys as a key_or_jsonobject

Same is true for JSON arrays: if you need to remove several elements from JSON array pass an array of elements to be removed.

8. JCLEAR

Clears a whole JSON object or nested object using a path provided.

JCLEAR(json_object, key_or_jsonobject_optional)

Replace:

json_object parameter with an object you want to use;

key_or_jsonobject_optional optional parameter with the key to find a field you need to remove or with path to nested object as array of elements.

9. JSIZE

Returns a number of elements in JSON content.

JSIZE(json_object)

Replace json_object parameter with an object or array you want to get size of.

10. JEXIST

Checks if an element exists in JSON.

JEXIST(json_object, path)

Replace:

json_object parameter with an object you want to use ;

path parameter with the path to find a field you need to check (or index if you work with JSON array).

11. JMERGE

Merges 2 JSON objects into one.

JMERGE(json_object, json_object)

Replace both json_object parameters with objects you want to merge.

12. JEACH

Executes specified function for each element of the list.

JEACH(json_array, function, exclude_nulls_boolean)

Replace:

json_array parameter with an array you want to use;

function parameter with expression to be executed for each array element;

optional exclude_nulls_boolean parameter with true to have null values be excluded from the resulting array, or with false, if include null values.

circle-info

You can get current element by using the merge field "{$JEach}" and current element index by using the merge field "{$JEachIndex}".

13. JEACHMAP

Executes specified functions for each key and/or value of the JSON object.

JEACHMAP(json_object, key_function, value_function)

Replace:

json_obect parameter with an object you want to use;

key_function parameter with expression to be executed for each key of the object;

value_function with expression to be executed for each value of the object.

circle-info

If you don't need to trigger function execution for object keys pass {$JEachKey} as a key_function parameter, if no function needs to be run for object values - pass {$JEach} as value_function parameter.

You can get current element by using the merge field "{$JEach}" and you can get current element index by using the merge field "{$JEachIndex}".

14. JVAR

Defines formula local variables.

JVAR(var1_name, va1_value_function, var2_name, va2_value_function, ..., value_function)

Replace:

var1_name, var2_name , etc. parameters with variables names;

va1_value_function, va2_value_function, etc parameters with an expression to be executed as the value for the variables;

value_function with an expression to be executed as the result of the function.

circle-info

To get access to the variable use the merge field "{$JVar.var1_name}", where "var1_name" is the variable name.

15. JFOR

Executes specified function for each element of the list.

JFOR(from_decimal, to_decimal, expression, exclude_nulls_boolean_optional)

Replace:

from_decimal parameter with a number to start loop from;

to_decimal with a number to stop loop at;

expression with expression to be executed for each iteration;

optional exclude_nulls_boolean_optional parameter with true to have null values be excluded from the result, or with false, if include null values.

Last updated