Since this problem is encountered in the project, record it here.
For example: The requested JSON string:
1 {2"MSG": "Data acquisition succeeded",3"Success":true,4"Data":[5 {6"id": 40,7"Name": "Art",8"ParentID": 4,9"Photourl": "[email protected]",Ten"Enable": 1, One"POS": 2, A"Visiturl": "Syspxbpage", -"Ord": 0, -"Related": "1", the"Moduletype": "", -"Catelist":[ - { -"ID": 155, +"ModuleID": 40, -"Name": "Sculpture", +"Photourl": "Syspxbpage/artpage/[email protected]", A"Enable": 1, at"Createtime": 1508498216000 - } - ] - }, - { -"id": 41, in"Name": "Calligraphy", -"ParentID": 4, to"Photourl": "[email protected]", +"Enable": 1, -"POS": 2, the"Visiturl": "Syspxbpage", *"Ord": 0, $"Related": "1",Panax Notoginseng"Moduletype": "", -"Catelist":[ the { +"ID": 158, A"ModuleID": 41, the"Name": "The inscription", +"Photourl": "Syspxbpage/writingpage/[email protected]", -"Enable": 1, $"Createtime": 1508498326000 $ } - ] - } the}
For example: Get the value of Photourl:
Jsonobject da = resultjson.getjsonobject ("Data");
Jsonarray d = da. Jsonarray ("Catelist");
Jsonobject ob = (jsonobject) d.get (0); Here is the first object to get
String result = ob.getstring ("Photourl");
If you get the value of success:
Resultjson.getbooleanvalue ("Success");
Iterative parsing of JSON simple instances