mardi 29 décembre 2015

Parsing Dynamic JSON Data with Gson and Store it in SQlite DB in Android

I get this JSON response from server in my Android application and I want to parse this data by Gson , In Json Response permission tag of my may contains 20-25 data with key like 1, 2,... every value of the permission contains two information separated by # key I want to display only those things which comes into response. Parsed Object Class(Pojo or Model Class must be Parcelable implemented ) My application also support offline feature so, Need suggestion how I can store data in DB at same time when parsing.

[{
    "permission": {
        "0": "Title#RaqStar",
        "1": "Desc#Reader of Raw Star",
        "3": "Tytpe#Entertainment",
        "4": "Rating#4.5"
    },
    "id": "233",
    "name": "Movie Raw Star"
}, {
    "permission": {
        "0": "Title#RaqStar",
        "3": "Tytpe#Entertainment",
        "4": "Rating#4.5"
    },
    "id": "233",
    "name": "Movie Raw Star"
}, {
    "permission": {
        "1": "Desc#Reader of Raw Star",
        "3": "Tytpe#Entertainment",
        "4": "Rating#4.5"
    },
    "id": "233",
    "name": "Movie Raw Star"
}, {
    "permission": {
        "1": "Desc#Reader of Raw Star",
        "4": "Rating#4.5"
    },
    "id": "233",
    "name": "Movie Raw Star"
}]

Aucun commentaire:

Enregistrer un commentaire