public class Json
{
public static void main(String[] args) throws JSONException
{
//JSON格式
String jsonStr = "{\"UserID\":[1,2,3,4,5,6]}";
JSONObject jsonObject = new JSONObject(jsonStr);
Object object = jsonObject.get("UserID");
System.out.println("UserID的值:" + object);
JSONArray json = (JSONArray)object;
for (int i = 0; i < json.length(); i++)
{
System.out.println("数组的值:" + json.get(i));
}
}
}