The Movie Database Подршка

All of a sudden I'm having customers complaining about an error every time they try to search for a movie using my program. I haven't changed any code on my end in quite some time. The error when parsing the JSON is "Input string was not in a correct format." When I run a test on apiary the following is shown in red:

"1": The ‘production_countries,1’ property is required. | The production_countries,1 property must be an object (current value is undefined). { "iso_3166_1": "US" The ‘production_countries,1,iso_3166_1’ property is required. "name": "United States of America" The ‘production_countries,1,name’ property is required.

Did something change in the API to cause this? If so, do you have any idea how I can easily fix this? I've created a custom .net dll based off TMDbLib using Newtonsoft.Json instead.

Thanks!

10 одговора (на страни 1 од 1)

Jump to last post

No, nothing changed.

Apiary aside, what's that error actually mean? Does it reference an invalid object or key?

Thank you for the response. I basically learn this stuff as I go, so if I seem like a newbie, sorry. Here is what I've got, hopefully you can help!

It is throwing the error here: Movie resp = JsonConvert.DeserializeObject(response, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });

Here is my Movie class:


        public bool adult { get; set; }
        public string backdrop_path { get; set; }
        public BelongsToCollection belongs_to_collection { get; set; }
        public Int64 budget { get; set; }
        public List genres { get; set; }
        public string homepage { get; set; }
        public int id { get; set; }
        public string imdb_id { get; set; }
        public string original_title { get; set; }
        public string overview { get; set; }
        public double popularity { get; set; }
        public string poster_path { get; set; }
        public List production_companies { get; set; }
        public List production_countries { get; set; }
        public string release_date { get; set; }
        public Int64 revenue { get; set; }
        public int runtime { get; set; }
        public List spoken_languages { get; set; }
        public string status { get; set; }
        public string tagline { get; set; }
        public string title { get; set; }
        public double vote_average { get; set; }
        public Int64 vote_count { get; set; }
        public AlternativeTitles alternative_titles { get; set; }
        public Casts casts { get; set; }
        public Images images { get; set; }
        public Releases releases { get; set; }
        public SearchContainer lists { get; set; }
        public Trailers trailers { get; set; }
        public TranslationsContainer translations { get; set; }
        public KeywordsContainer keywords { get; set; }
        public SearchContainer similar_movies { get; set; }
        public List changes { get; set; }

I am not sure which one is actually throwing the error. I only brought up production_countries because that is what was in red on apiary. Do you see anything? Like I said, it was working fine for months for everybody using my program, but all of a sudden it isn't working for any search.

If you need any more info, I'd be happy to get it for you. Thanks!

Hi Mark,

Do you have an example search that is throwing the error?

I am wondering if it's the combination poster_path and backdrop_path definitions you have there being set to strings. If no image exists the result is null, not an empty string. I have absolutely zero knowledge about C# but if things are strongly typed like that, the JSON parser could be throwing an error when null comes in expecting to be a string.

Example that is throwing the error:

/3/movie/62211?api_key=[mykey]&append_to_response=alternative_titles,casts,images,releasese,lists

The NullValueHandling = NullValueHandling.Ignore in the JsonSerializerSettings should ignore the nulls so they don't throw an error.

Thanks!

Is that releasese the actual response you're trying to append? That looks like a typo but I'm not clear if it was something that got mucked around pasting it in here or if that's what your code actually says.

I don't see anything else that sticks out though.

Sorry. That was a typo. Ok. I'll do some more messing around to see if I can figure it out. Thanks.

FYI: I figured it out. It looks like the height and width for each of the appended images were no longer integers. For example: the response text shows: "height":1080.0 So it was flipping out when it saw the decimal point. I switched them to parse as a double instead of an integer and it now parses them correctly. Thanks!

Interesting!

I should probably coerce them back to integers, but as long as the change you just made will just with that we're good.

I'll get this fixed up later this afternoon.

Great! Yeah, it would be better on my end if you switch them back to integers so I don't have to send out an update... but like you said, either way will work. Thanks!

Fix for this was pushed about 10 minutes ago but we'll have to wait for all of the already cached items to expire from the cache. Should be fixed for all newly cached items from here on in.

Не можеш да нађеш филм или серију? Пријави се да додаш.

Глобално

s фокусирај траку за претрагу
p отворите мени профила
esc затворити отворени прозор
? отвори прозор пречице на тастатури

На страницама медија

b вратити се назад (или родитељу кад је то применљиво)
e иди на страницу за уређивање

На страницама ТВ сезона

(стрелица надесно) пређите на следећу сезону
(лева стрелица) иди на претходну сезону

На страницама ТВ епизода

(стрелица надесно) пређите на следећу епизоду
(лева стрелица) иди на претходну епизоду

На свим страницама са сликама

a отвори прозор за додавање слике

На свим страницама за уређивање

t отвори селектор превода
ctrl+ s пошаљи образац

На страницама за дискусију

n отвори нову дискусију
w мења статус гледања
p мења јавно/приватно
c мења отвори/затвори
a отвори активност
r одговор на дискусију
l иди на последњи одговор
ctrl+ enter пошаљи поруку
(стрелица надесно) следећа страница
(лева стрелица) претходна страница

Подешавања

Желите ли да оцените или додате ову ставку у листу?

Пријави се