I am using : import com.fasterxml.jackson.databind.*
I have a json array :
{"nodes":
[
{"blockId":"decision1422461296135","text":"hello"},
{"blockId":"Action1422461296640","text":"Action"},
{"blockId":"prompt1422461298089","text":"Prompt"}
]
}
I want to convert the above array to a HashMap< String,Node > , where the key is the blockId and Node is a POJO with id and text fields in it.
I would rather not use any other external library.
Right now I am converting the JSON array to an Array of Nodes and then iterating through the array to create the HashMap I want. I don't think this is optimized. I want to create the HashMap when the ObjectMapper parses the JSON (so just 1 pass through the JSON array).