Extracting JSON fields using java

前端 未结 3 625
傲寒
傲寒 2021-01-15 12:55

I am trying to extract a person\'s details who liked a facebook page by passing the page id as parameter. I extracted the JSON content of that page and now from that I want

3条回答
  •  忘掉有多难
    2021-01-15 13:46

    This snippet is not tested, but I'm pretty sure it works:

    JSONArray data = json.getJSONArray("data");
    for (int i=0; i < data.length(); i++) {
        JSONObject o = data.getJSONObject(i);
        sysout(o.getString("id");
        sysout(o.getString("name");
    }
    

提交回复
热议问题