JsonList parser

Hi @tmacgbay
i solved creating my own function after remove double quote and using

let json_tree = parse_json(to_string($message."message_unquote"));
let jsonNode = to_map(json_tree);

my function is named list_fieldKVMap where

for example:

list_fieldKVMap(“DeviceProperties”, jsonNode[“DeviceProperties”], “Name”, “Value”);

So, inside I get the object list and extract the field/value attribute. I add a new field using the parameterKey as key prefix

Remembering the input data:

{“DeviceProperties”:[{“Name”:“OS”,“Value”:“MacOs”},{“Name”:“BrowserType”,“Value”:“Chrome”},{“Name”:“IsCompliantAndManaged”,“Value”:“False”},{“Name”:“SessionId”,“Value”:“dc4fe5cd-6bbf-4968-946a-51b5e7c4f872”}]}

the output is something like this:
image

With this approach I can reuse this function for other object list changing the attributes that I have to use for new field generation

Gianluca

2 Likes