mercredi 28 mars 2018

JSONAPI-Serializer: Deserialize function doesn't update attributes key for nested objects

I am using JSONAPI-Serializer to serialize/deserialize my json object in Node js. See below the json object

{
"links": {
},
"meta": {
},
"data": [{}],
"included": [
    {
        "type": "obj1",
        "id": "",
        "attributes": {
            "newId": "",
            "type": "abc",
            "tag": [
                ""
            ],
            "systemTag": {
                "system_Tag": [
                    "mydeal"
                ]

At the end of this json you can see the "systemTag" key as camelCase and its value "system_tag" as snake_Case. When I serialize both key and value it is serialized to snake_Case as system_tag but When I deserialize only key is converted back to camelCase not the value as you can see in the above json.

While deserializing I have used the attribute "keyForAttribute: 'camelCase'" of JSONAPISerializer with my model object.

It would be great help!




Aucun commentaire:

Enregistrer un commentaire