我想将数据输入自定义字段:
我使用以下代码获取有效类别的数据:
List<MusicModel.category> cateList = new ArrayList<>();
for(int j = 0; j < finalobject.getJSONArray("categories").length(); j++ )
{
MusicModel.category cate = new MusicModel.category();
cate.setCateTitle(finalobject.getJSONArray("categories").getJSONObject(j).getString("title"));
cateList.add(cate);
}
musicModel.setListCategory(cateList);
答案 0 :(得分:0)
参考吹码:
JSONObject responseObject = new JSONObject(reponseData);
JSONObject postObject = responseObject.optJSONObject("post");
if(null != postObject) {
JSONObject customFields = postObject.optJSONObject("custom_fields");
JSONArray postViewCount = customObject.optJSONArray("post_view_count");
JSONObject postCountObject = postViewCount.get(0);
String postCount = postCountObject.toString();
}