String jsondata="{\"studentResult\":[{\"sem1\" :[{\"subname\":\"TOC\",\"subcode\":\"1009\",\"subcredit\":\"6\",\"subgrade\":\"AB\"},
{\"subname\":\"DS\",\"subcode\":\"10090\",\"subcredit\":\"5\",\"subgrade\":\"BB\"},
{\"subname\":\"TOC\",\"subcode\":\"1009\",\"subcredit\":\"6\",\"subgrade\":\"AB\"}]},{\"sem2\":
[{\"subname\":\"AAS\",\"subcode\":\"111009\",\"subcredit\":\"6\",\"subgrade\":\"AB\"},
{\"subname\":\"AE\",\"subcode\":\"103309\",\"subcredit\":\"6\",\"subgrade\":\"DD\"}] }]}";
答案 0 :(得分:0)
在这里试试:
String json = "{\"key\":\"value\",\"key\":\"value\"}";
try {
JSONObject obj = new JSONObject(json);
Log.i("My App", "JSONObject in String: " + obj.toString());
} catch (JSONException e) {
e.printStackTrace();
}