-4

I have the following JSON:

[{
 "aaa": "blah",
 "ddd": 2
}]

Note that the map is inside an array. How to get the map and then the value of "aaa".

Using Json Simple.

Thanks!

asked Apr 28, 2020 at 17:44
2

1 Answer 1

-1

The following code should work. Let me know if it doesn't!

Object obj = JSONValue.parse(jsonString);
JSONArray array = (JSONArray)obj;
JSONObject obj2 = (JSONObject)array.get(0);
String result = obj2.get("aaa") 
answered Apr 28, 2020 at 18:55
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.