jsonfacebookpagination

Graph API - get JSON data without "paging" key


I'm getting facebook data using graph api, adding fields in string and get JSON result.

Example:

https://graph.facebook.com/me?fields=music

But JSON returned contains a "paging" key and I do not I want this key.

{ "music":{
  "data":[
     {
        "name":"",
        "category":"",
        "id":"",
        "created_time":""
     },
     {
        "name":"",
        "category":"",
        "id":"",
        "created_time":""
     }
  ],
  "paging":{
     "next":"https://graph.facebook.com/me?fields=music&method=GET&metadata=true&format=json&callback=___GraphExplorerAsyncCallback___&access_token=...&limit=5000&offset=5000&__after_id=..."
  }}}

EDITED:

I'm using Java API (restfb.com) to get JSON.

The command in java is:

FacebookClient client = new DefaultFacebookClient("ACCESS_TOKEN_HERE");
JsonObject rMusic = client.fetchObject("ID_HERE", JsonObject.class, Parameter.with("fields", "id,name,religion,birthday,music"));

How do I avoid it or remove it?


Solution

  • Based upon the edit to the question above, here's a new answer.

    The Rest API is deprecated. You should upgrade your app to use the Graph API as this is the one being supported.

    Also, if you see a property you don't like, you don't have to access it. Remember, there's no law in coding that you have to look at every property in your scripts.