Discussions

Ask a Question
Back to All

Change "genres" response for a show

There is a mistake about a json fields in a show response. It can be an object or an empty array.

{
    "shows": {
        "genres": {
            "Action": "Acción",
            "Adventure": "Aventura",
            "Drama": "Drama",
            "Fantasy": "Cine fantástico"
        }
    }
}

// or

{
    "shows": {
        "genres": []
    }
}

And when it's an object the keys are dynamic :/

It's hell to deserialize and you should design the json reading best practices.

Please do something like that:

{
    "shows": {
        "genres": [
            {
                "genre": "Action",
                "translation": "Acción",
            },
            {
                "genre": "Adventure",
                "translation": "Aventura",
            },
            {
                "genre": "Drama",
                "translatin": "Drama",
            },
            {
                "genre": "Fantasy",
                "translatin": "Cine fantástico",
            },
        ]
    }
}

{
    "shows": {
        "genres": []
    }
}

Or

{
    "shows": {
        "genres": [
            "Acción",
            "Aventura",
            "Drama",
            "Cine fantástico"
        ]
    }
}

Everything but not a dynamic object with dynamic keys or an empty array when there is no genres.