How to convert json in android There is a message of the form
{"type": "message", "data": {"time": 1385077892240, "text": "Hello", "author": false, "color": false}}
how to convert to Android
How to convert json in android There is a message of the form
{"type": "message", "data": {"time": 1385077892240, "text": "Hello", "author": false, "color": false}}
how to convert to Android
Maybe your question is how to use json format in java, there will be many third party library u can found by google. I don't use java, but i heard the GSON library which is provided by google.
You can do this:
import org.json.JSONException;
import org.json.JSONObject;
String strJSON;
JSONObject json;
strJSON = "{\"type\": \"message\", \"data\": {\"time\": 1385077892240, \"text\": \"Hello\", \"author\": false, \"color\": false}}";
try {
json = new JSONObject(strJSON);
Log.d("JSON-Obj", json.getString("type"));
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}