For logging purpose, I print out json response string and can see them in android "adb logcat" command. Is there a way to nicely format the json string in adb logcat output so that it looks like this?
{ "code" : "0",
"text" : "hello world"
}
You can use the JSONObject.toString()
method to pretty print the JSON on logcat.
Log.d("tag", jsonObject.toString(4));
Output
(29124): {
(29124): "text": "hello world",
(29124): "code": "0"
(29124): }