Skip to content Skip to sidebar Skip to footer

Deserialize Json Facebook Feed Using Gson

I have a JSON response from Facebook with the following structure: { 'data': [ { 'id': '105458566194298_411506355589516', 'message': '...', 'ty

Solution 1:

You should do something like that:

InputStreamsource= retrieveStream(url);
Gsongson=newGson();
Readerreader=newInputStreamReader(source);
APIResponseresponse= gson.fromJson(reader, APIResponse.class);

With:

PublicclassAPIResponse{

    ArrayList <FacebookPost> data;

    publicclassFacebookPost{
        publicString message;
        publicString created_time;
    }
}

Post a Comment for "Deserialize Json Facebook Feed Using Gson"