how to parse json string to objects list in java

www.la‮c.iruttu‬om
how to parse json string to objects list in java
/**
 * @author lautturi.com 
 * Java example:how to parse json string to JSONObject JSONArray in java
 */

import java.util.*;

import org.json.JSONArray;
import org.json.JSONObject;

public class Lautturi {

	public static void main(String[] args) {

		String jsonString = "{\"employees\":[{\"id\":111,\"name\":\"Lautturi\"}, {\"id\":112,\"name\":\"James\"}]}";

		 JSONObject json = new JSONObject(jsonString);
		 JSONArray arr = json.getJSONArray("employees");
		 System.out.println(arr);
	}
}

output:

[{"name":"Lautturi","id":111},{"name":"James","id":112}]
Created Time:2017-10-02 22:41:38  Author:lautturi