Skip to main content

Text Functions

The json function package contains functions for creating, querying, and manipulating JSON objects.

IMPORT json.*; -- imports all functions
IMPORT json.toJson; -- imports single function

Reference

The following table lists all the functions in the json package with a short description.

Function NameDescription
jsonArrayCreates a JSON array from the list of JSON objects and scalar values.
jsonArrayAggAggregation function that aggregates JSON objects into a JSON array.
jsonExistsFor a given JSON object, checks whether the provided JSON path exists
jsonExtractExtracts a value from the JSON object based on the provided JSON path. An optional third argument can be provided to specify a default value when the given JSON path does not yield a value for the JSON object.
jsonObjectCreates a JSON object from key-value pairs, where the key is mapped to a field with the associated value. Key-value pairs are provided as a list of even length, with the first element of each pair being the key and the second being the value. If multiple key-value pairs have the same key, the last pair is added to the JSON object.
jsonObjectAggAggregation function that merges JSON objects into a single JSON object. If two JSONobjects share the same field name, the value of the later one is used in the aggregated result.
jsonQueryFor a given JSON object, executes a JSON path query against the object and returns the result as string.
jsonToStringConverts a JSON object to string
toJsonParses a JSON object from string