How to convert linkedHashMap to list / json object

Hi Team,

I have an input json in linkedHashMap in below format:

[
{
“Path”: “/OrgName/shared”,
“subject_type”: [
“GROUP”,
“GROUP”,
“GROUP”,
“USER”
],
“subject”: [
“Operations”,
“admins”,
“Architects”,
xyz@xyz.com
],
“perms”: [
[
“R”,
“X”,
“W”
],
[
“R”,
“X”
],
[
“R”,
“X”
],
[
“R”,
“X”
]
]
},
{
“Path”: “/OrgName/shared2”,
“subject_type”: [
“GROUP”,
“GROUP”,
“GROUP”,
“USER”
],
“subject”: [
“Operations”,
“admins”,
“Architects”,
abc@abc.com
],
“perms”: [
[
“R”,
“X”,
“W”
],
[
“R”,
“X”
],
[
“R”,
“X”
],
[
“R”,
“X”
]
]
}
]

My requirement is to map the respective fields and need them in a file as below:

{
{ “Path”: “/OrgName/shared”,
“subject_type”:“GROUP”,
“subject”:“Operations”
“perms”: [
“R”,
“X”,
“W”
]
},
{ “Path”: “/OrgName/shared”,
“subject_type”:“GROUP”,
“subject”:“admins”
“perms”:
[
“R”,
“X”
]

	},
	{ "Path": "/OrgName/shared",
    "subject_type":"GROUP",
	"subject":"Architects"
	"perms": 
            [
            "R",
            "X"
        ]
        
	},
	{ "Path": "/OrgName/shared",
    "subject_type":"user",
	"subject":"xyz@xyz.com"
	"perms": 
            [
            "R",
            "X"
        ]
        
	}
	}

can it be achieved using any inbuilt snaps or should we go for a script? Any script snippets is appreciated.

Regards,
Satya

Please take a look at the sl.zip function.

Hi Satya,

Please find the attached pipeline for the solution.

Regards,
Anil

Convert_LinkedHashMap_to_list_2019_12_31.slp (6.7 KB)

Many thanks for the reply. This resolved my issue.

Hello Anil,

The pipeline exactly matches my requirement. Thank you for your time on this.

Regards,
Satya

1 Like