I am working with a JSON
object that looks like this:
"links" : [ {
"rel" : "first",
"href" : "http://localhost:8080/first"
}, {
"rel" : "self",
"href" : "http://localhost:8080/self"
}, {
"rel" : "next",
"href" : "http://localhost:8080/next"
}];
My goal is to retrieve the href
URL where rel = "next"
.
Question: how can I achieve this using JavaScript?
In Java, I would iterate through the array and create an inverted HashMap<Rel, Href>
, then use map.get("next");
.
But what is the equivalent method in JavaScript?