Flatten an array of objects to Map #242
cvsudheer108
started this conversation in
General
Replies: 1 comment 3 replies
-
Which part of this are you having difficulties with? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi JSLT Team,
I have this input:
[{
"schema" : "http://schemas.schibsted.io/thing/pulse-simple.json#1.json",
"id" : "1",
"published" : "2017-05-04T09:13:29+02:00",
"type" : "View1",
"environmentId" : "urn:schibsted.com:environment:uuid",
"url" : "http://www.aftenposten.no/"
},
{
"schema" : "http://schemas.schibsted.io/thing/pulse-simple.json#1.json",
"id" : "2",
"published" : "2017-05-04T09:13:29+02:00",
"type" : "View2",
"environmentId" : "urn:schibsted.com:environment:uuid",
"url" : "http://www.aftenposten.no/"
}
]
And I want to get a Map back like this:
{
"1" : {
"schema" : "http://schemas.schibsted.io/thing/pulse-simple.json#1.json",
"id" : "1",
"published" : "2017-05-04T09:13:29+02:00",
"type" : "View1",
"environmentId" : "urn:schibsted.com:environment:uuid",
"url" : "http://www.aftenposten.no/"
},
"2" : {
"schema" : "http://schemas.schibsted.io/thing/pulse-simple.json#1.json",
"id" : "2",
"published" : "2017-05-04T09:13:29+02:00",
"type" : "View2",
"environmentId" : "urn:schibsted.com:environment:uuid",
"url" : "http://www.aftenposten.no/"
}
}
How do I get that done with JSLT??
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions