david
david

Reputation: 1077

Contruct json into Map<String, Object>

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?

Upvotes: 0

Views: 39

Answers (1)

xingbin
xingbin

Reputation: 28269

You can create a List<String> and add "meta","data","thead" to the list, then add the List<String> to the map.

Upvotes: 2

Related Questions