Skip to content

Conversation

@mdisibio
Copy link

@mdisibio mdisibio commented Dec 2, 2022

Getting an error on Plex 1.27.1.5916 json: cannot unmarshal array into Go struct field Metadata.MediaContainer.Metadata.rating of type float64 during GetSessions().

It seems that there is a new json field Rating that conflicts with the (deprecated?) existing rating which is float64. An example response looks like this (trimmed for clarity):

{
    "MediaContainer": {
        "size": 1,
        "Metadata": [
            {
                "parentTitle": "Season 6",
                "ratingKey": "5417",
                "sessionKey": "48",

                "Rating": [
                    {
                        "image": "themoviedb://image.rating",
                        "type": "audience",
                        "value": "7.7"
                    }
                ],

There is no float64 rating, but the new Rating array. Golang json unmarshalling attempts case-sensitive field match first, but falls back to case-insensitive and ends up colliding with rating.

This fix introduces a new Rating struct and the case-sensitive json name, however the go-field is Ratings to not conflict with the existing Rating float64.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant