CodePudding user response:
You use a JsonObject receiving, then assemble lineCodePudding user response:
The import org. Json. JSONException;
The import org. Json. JSONObject;
Private void ParseJson (String jsonStr) {
//jsonStr the return value is a JSON string
Try {
JSONObject JSONObject=new JSONObject (jsonStr);
//according to the key value, key
String s="a -" + jsonObject. Get String (" a ")
+ ", "b" - "+ jsonObject. Get string (" b")
+ "c -" + jsonObject. Get string (" c ")
+ ", d - "+ jsonObject. Get string (" d")
+ ", e - "+ jsonObject. Get string (" e");
The e (" TAG ", s);
} the catch (JSONException e) {
e.printStackTrace();
}
}
CodePudding user response:
Their stitching or replace with
JSONObject json=new JSONObject (jsonStr);
String s=json. Replace (" {", "")
Replace ("} ", "")
ReplaceAll (" \ ""," ")
ReplaceAll (" : ", "-");
The e (" TAG ", s);