vendredi 11 décembre 2015

Serialize the response from backend yto store ember store

My response from backend is not in form which ember store.I am not able to serialize the reponse.

response.json

[{
    "pk": 127,
    "url": "http://ift.tt/1Y7qNWd",
    "gallery_name": "Faces",
    "thumbnail_url": "http://ift.tt/1mehxE9",
    "time": "1 month ago",
    "description": "Created by user",
    "is_following": true,
    "feedPhotos": [{
            "pk": 624,
            "url": "http://ift.tt/1Y7qPNQ",
            "profilePic": "http://ift.tt/1mehvMp",
            "userName": "Nabeela",
            "userKarma": 915,
            "caption": "Old woman spinning her 'chhos-khor' ...a rotation of which is equivalent to the recitation of a mantra.",
            "numComments": 0,
            "owner": "http://ift.tt/1Y7qNWh",
            "time": "1 month ago",
            "photo_url": "http://ift.tt/1mehxEf",
            "comments_url": "http://ift.tt/1Y7qPNU",
            "numFives": 4,
            "fivers_url": "http://ift.tt/1mehvMr",
            "fivers_pk": 1362,
            "fullphoto_url": "http://ift.tt/1Y7qPNW",
            "fullphoto_pk": 1362,
            "is_fived": true,
            "hiFiveKarma": 1,
            "owner_pk": 44,
            "userFirstName": "Nabeela",
            "is_bookmarked": false
        }, {
            "pk": 574,
            "url": "http://ift.tt/1mehvMt",
            "profilePic": "http://ift.tt/1mehxUt",
            "userName": "Rohini",
            "userKarma": 194,
            "caption": "Life @ Myanmar!",
            "numComments": 0,
            "owner": "http://ift.tt/1Y7qPNY",
            "time": "2 months ago",
            "photo_url": "http://ift.tt/1mehxUv",
            "comments_url": "http://ift.tt/1Y7qPO0",
            "numFives": 2,
            "fivers_url": "http://ift.tt/1Y7qPO6",
            "fivers_pk": 1303,
            "fullphoto_url": "http://ift.tt/1Y7qQ4m",
            "fullphoto_pk": 1303,
            "is_fived": false,
            "hiFiveKarma": 0,
            "owner_pk": 45,
            "userFirstName": "Rohini",
            "is_bookmarked": false
        }
    ]
}, {
    "pk": 65,
    "url": "http://ift.tt/1mehxUx",
    "gallery_name": "Royal",
    "thumbnail_url": "http://ift.tt/1Y7qQ4o",
    "time": "2 months ago",
    "description": "This is a gallery about Royal",
    "is_following": false,
    "feedPhotos": [{
        "pk": 347,
        "url": "http://ift.tt/1mehvMz",
        "profilePic": "http://ift.tt/1mehvMp",
        "userName": "Nabeela",
        "userKarma": 915,
        "caption": "I cannot forget the name of this palace - Moti Mahal (translation: Pearl Palace). Indescribably beautiful, ainnit! at Mehrangarh fort, Jodhp",
        "numComments": 0,
        "owner": "http://ift.tt/1Y7qNWh",
        "time": "2 months ago",
        "photo_url": "http://ift.tt/1Y7qNWv",
        "comments_url": "http://ift.tt/1mehvMB",
        "numFives": 4,
        "fivers_url": "http://ift.tt/1Y7qQ4u",
        "fivers_pk": 759,
        "fullphoto_url": "http://ift.tt/1mehvMD",
        "fullphoto_pk": 759,
        "is_fived": false,
        "hiFiveKarma": 0,
        "owner_pk": 44,
        "userFirstName": "Nabeela",
        "is_bookmarked": false
    }, {
        "pk": 593,
        "url": "http://ift.tt/1Y7qOcJ",
        "profilePic": "http://ift.tt/1mehxUA",
        "userName": "Vikanshu",
        "userKarma": 932,
        "caption": "Marvelous architecture!! in Florence, Italy",
        "numComments": 0,
        "owner": "http://ift.tt/1Y7qQ4A",
        "time": "1 month ago",
        "photo_url": "http://ift.tt/1mehxUC",
        "comments_url": "http://ift.tt/1Y7qQkQ",
        "numFives": 4,
        "fivers_url": "http://ift.tt/1mehxUE",
        "fivers_pk": 1363,
        "fullphoto_url": "http://ift.tt/1Y7qQkS",
        "fullphoto_pk": 1363,
        "is_fived": false,
        "hiFiveKarma": 0,
        "owner_pk": 48,
        "userFirstName": "Vikanshu",
        "is_bookmarked": false
    }]
}]

How do I serialize this using JSONPISerailizer or any other serializer in ember-cli so that it gets stored in ember store




Aucun commentaire:

Enregistrer un commentaire