I want to construct the following json into a Map<String, Object>
{"tm":"3-ticker-payout-history-full-screen","r":"ES","default_tab":"overview","slug":"alt-group","only":["meta","data","thead"]}
Below is what I have so far
Map<String, Object> map = new HashMap<>();
map.put("tm", "3-ticker-payout-history-full-screen");
map.put("slug", "alt-group");
map.put("r", "ES");
map.put("default_tab", "overview");
How would I add "only":["meta","data","thead"]
to the hashmap?
asked Sep 16, 2020 at 3:21
1 Answer 1
You can create a List<String>
and add "meta","data","thead"
to the list, then add the List<String>
to the map.
answered Sep 16, 2020 at 3:24
Sign up to request clarification or add additional context in comments.
Comments
lang-java
map.put("only", Arrays.asList("meta","data","thead"));