cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert linkedHashMap to list / json object

Satyanarayana
New Contributor II

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

1 ACCEPTED SOLUTION

Anil
New Contributor III

Hi Satya,

Please find the attached pipeline for the solution.

Regards,
Anil

Convert_LinkedHashMap_to_list_2019_12_31.slp (6.7 KB)

View solution in original post

4 REPLIES 4

cstewart
Former Employee

Please take a look at the sl.zip function.

Many thanks for the reply. This resolved my issue.

Anil
New Contributor III

Hi Satya,

Please find the attached pipeline for the solution.

Regards,
Anil

Convert_LinkedHashMap_to_list_2019_12_31.slp (6.7 KB)

Satyanarayana
New Contributor II

Hello Anil,

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

Regards,
Satya