4

This is my ArrayList

ArrayList< HashMap < String,String> > list =  new ArrayList<>();

which holds hashmap.

How to acquire all the hashmaps in Plain JSONArray?

3
  • this is org.primefaces.json.JSONArray? Commented May 13, 2019 at 20:20
  • @alibttb this is org.json.JSONArray Commented May 16, 2019 at 7:51
  • this is not available in standard java nor in jee, what library contains this class? @Vaibhav Kadam Commented May 16, 2019 at 20:05

1 Answer 1

14

We can do something like this,

ArrayList< HashMap < String,String> > list =  new ArrayList<>();

and then just pass List object to JsonArray like this

JSONArray jsArray = new JSONArray(list);

thankew!

Sign up to request clarification or add additional context in comments.

1 Comment

in Gson 2.8.2 we dont have this one yet.

Your Answer

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.