mapStrToJson

Convert unstructured openDistro Map String to JSON.

Convert the unstructured openDistro Map String as a parameter and converts it into a proper JSON like string.

Usage Details

select *, mapStrToJson(column) as mapToJsonData from tablename

Input Parameters:
column: Value of column on which parsing needs to be done.

Output:
Returns back JSON parsed string

Example

Input Table: input_table

openDistroMapData

List(Map(name -> login_success, type -> login, parameters -> List(Map(name -> login_type, value -> google_password), Map(name -> login_challenge_method, multiValue -> List(password, password, password, security_key)), Map(name -> is_suspicious, boolValue -> false))))

select *, mapStrToJson(openDistroMapData) from input_table

Output:

openDistroMapData

convertedJsonData

List(Map(name -> login_success, type -> login, parameters -> List(Map(name -> login_type, value -> google_password), Map(name -> login_challenge_method, multiValue -> List(password, password, password, security_key)), Map(name -> is_suspicious, boolValue -> false))))

[{"name":"login_success","type":"login","parameters":[{"name":"login_type","value":"google_password"},{"name":"login_challenge_method","multiValue":["password","password","password","security_key"]},{"name":"is_suspicious","boolValue":false}]}]


Did this page help you?