Extracting JSON fields using java

前端 未结 3 550
傲寒
傲寒 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:37

    Code like this would do the trick.

    JSONObject json = readurl("https://graph.facebook.com/pageid");
    JSONArray dataJsonArray = json.getJSONArray("data");
    for(int i=0; i

    Basically data is a JSONArray since it starts with [. So simply get would not work, you must use JSONArray.

    Note: I haven't compiled this code, but I think I gave you idea to proceed. Also refer this link to get hold of basics of parsing JSON in java.

提交回复
热议问题