[Solved] How do I parse a JSON array in Java? [duplicate]


The following is related to the JSON.simple library.


You need a JSONParser instance to get a JSONObject value from your String object.

JSONObject data;
try {
    JSONParser helper = new JSONParser();
    data = (JSONObject)helper.parse(String);
} catch (ParseException parse) {
    // Invalid syntax
    return;
}
// Note that these may throw several exceptions
JSONObject node = (JSONObject)data.get("verb");
JSONArray array = (JSONArray)node.get("syn");

solved How do I parse a JSON array in Java? [duplicate]