0

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
  • 2
    map.put("only", Arrays.asList("meta","data","thead")); Commented Sep 16, 2020 at 3:24

1 Answer 1

2

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

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.