Note: Before posting this here, I spent a chunk of time trying to look for a solution about this here, but couldn't find any.
I have this JSON file that contains multiple json objects that I want to read into a map, each object is of the format {"key1":"value1", "key2":"value2"}, I tried
Map<String, String> map = MAPPER.readValue(fixture("fixtures/file_name.json"), new TypeReference<Map<String, String>>() {});
as that worked for reading a file into a map of map of list (Map<String, Map<String, List<String>>>). Is there something that should be different?
My .json file looks like
[
{"key1":"value1_1", "key2":"value2_1"},
{"key1":"value1_2", "key2":"value2_2"},
...
]
I have also another json file that I want to read into a map, that looks like
[
"key1": {
"key1_1": [
{"key1_1_1":"value1", "key1_1_2":"value2"},
...
],
...
},
"key2":<int>,
"key3":{
"key3_1":[],
...
},
...
"key_n":<string>,
...
]
Can you help me map those files correctly, without writing too many lines of code?