Daniel Omara Daniel Omara - 1 year ago 87
JSON Question

How to parse nested Objects in android to readable html

I have this code from


JSONArray postArray = jsonObject.getJSONArray("posts");
// Go through each post
for (int i = 0; i < postArray.length(); i++) {
JSONObject postObject = postArray.getJSONObject(i);

Post post = new Post();
post.setCfs(postObject.getJSONObject("custom_fields").optString("entity", "N/A"));

that displays this

["Some text"]

I want it to display without

My Json for that specific part is as below

"date":"2016-02-10 10:28:42",
"ref_number":["ITB NUMBER: ITB\/002\/2016"],
"deadline":["26 February, 2016"],
"entity":["Refugees (xxx)"]

Answer Source

It seems that "entity" is array and you should try something like that:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download