json
Functions for parsing Mozilla-specific JSON data types.
extract_int_map (UDF)
Returns an array of key/value structs from a string representing a JSON map. Both keys and values are cast to integers.
This is the format for the "values" field in the desktop telemetry histogram JSON representation.
Parameters
INPUTS
input STRING
extract_string_map (UDF)
Returns an array of key/value structs from a string representing a JSON map.
Non-string non-null values are encoded as JSON.
Parameters
INPUTS
input STRING
OUTPUTS
ARRAY<STRUCT<key STRING, value STRING>>
from_map (UDF)
Converts a standard "map" like datastructure array<struct<key, value>> into a JSON value.
Convert the standard Array<Struct<key, value>> style maps to JSON values.
Parameters
INPUTS
input ANY type
OUTPUTS
json
from_map_json (UDF)
Converts a [{"key": ..., "value": ...}, ...] serialized map data structure into a JSON object value.
Converts a [{"key": ..., "value": ...}, ...] serialized map data structure into a JSON object value.
Parameters
INPUTS
input JSON
OUTPUTS
JSON
from_nested_map (UDF)
Converts a nested JSON object with repeated key/value pairs into a nested JSON object.
Convert a JSON object like { "metric": [ {"key": "extra", "value": 2 } ] } to a JSON object like { "metric": { "key": 2 } }.
This only works on JSON types.
Parameters
INPUTS
input JSON
OUTPUTS
JSON
js_extract_string_map (UDF)
This function has been deprecated.
Please use mozfun.json.extract_string_map instead.
Parameters
INPUTS
input STRING
OUTPUTS
ARRAY<STRUCT<key STRING, value STRING>>
mode_last (UDF)
Returns the most frequently occuring element in an array of json-compatible elements. In the case of multiple values tied for the highest count, it returns the value that appears latest in the array. Nulls are ignored.
Parameters
INPUTS
list ANY TYPE