omdbapi / OMDb-API

The Open Movie Database Bug Tracking
416 stars 20 forks source link

All fields are Strings #276

Open brady-aiello opened 1 year ago

brady-aiello commented 1 year ago

All of the fields returned in the response are Strings, including year, imdbRating, and Metascore. This makes sorting more difficult, because they need to be deserialized, and then they also need to be transformed. Nullable fields should also not be Strings with "N/A" for null values. Proposed changes:

  1. year -> Int
  2. Released (Date) -> Long
  3. imdbRating -> Float
  4. imdbVotes -> Int
  5. Metascore -> Int
  6. DVD (Date) -> Long
  7. BoxOffice -> Int (assuming USD or another specific currency)
  8. Production -> String? ("N/A" -> null
  9. Website -> String? ("N/A" -> null
  10. Response -> Boolean ("True" -> true)
  11. Rating.Value -> Float, ie
    "Ratings": [
    {
      "Source": "Internet Movie Database",
      "Value": "7.4/10"
    },
    {
      "Source": "Rotten Tomatoes",
      "Value": "40%"
    },
    {
      "Source": "Metacritic",
      "Value": "33/100"
    }
    ]

    ->

    "Ratings": [
    {
      "Source": "Internet Movie Database",
      "Value": 7.4
    },
    {
      "Source": "Rotten Tomatoes",
      "Value": 40.0
    },
    {
      "Source": "Metacritic",
      "Value": 33.0
    }
    ]