{"66":{"waktu":"2013-10-01 12:45:11","hp":"+6285716157476","sms":"BKPM:\ntest ke budi","flash":"0","sts":"1"}}
Asked
Active
Viewed 310 times
0
Ivaylo Strandjev
- 66,530
- 15
- 117
- 170
2 Answers
2
It is appearing the JSON structure... use the JSON parser to parse it
Refer the link how-to-parse-json-in-java
Community
- 1
- 1
Rakesh Soni
- 8,472
- 5
- 40
- 48
2
The easiest way to use Json parser for your String.
public static void main(String[] args) throws JSONException {
String jsonString = "{" +
" \"66\": {" +
" \"waktu\": \"2013-10-01 12:45:11\"," +
" \"hp\": \"+6285716157476\"," +
" \"sms\": \"BKPM:\\ntest ke budi\"," +
" \"flash\": \"0\"," +
" \"sts\": \"1\"" +
" }" +
"}";
JSONObject jsonObject = new JSONObject(jsonString);
JSONObject a = (JSONObject) jsonObject.get("66");
String sts = (String) a.get("sts");
System.out.println("sts=" + sts);
}
Output:
sts=1
Maxim Shoustin
- 78,004
- 28
- 199
- 222
-
why down-vote, please read answer first – Maxim Shoustin Oct 01 '13 at 07:38