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\"}] }]}";
Asked
Active
Viewed 47 times
-2

Kartheek
- 7,104
- 3
- 30
- 44

Chandan Parlecha
- 1
- 3
1 Answers
0
try this here:
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();
}

ruclip
- 758
- 10
- 20
-
That's not valid JSON - JSON strings cannot be single quoted, they must be double quoted. http://www.json.org/ – Adam Jenkins Jun 27 '15 at 23:49
-
Thanks Adam - fixxed! – ruclip Jun 28 '15 at 12:39