Mein Code funktioniert gut, wenn REST URL aufrufen:
http://api.feedzilla.com/v1/categories.jsonASP.NET Web API Casting http Antwort auf json Array
aber wenn ich rufe folgende URL ich Fehler:
http://api.feedzilla.com/v1/categories/15/articles.json?count=36&since=2012-11-15&client_source=&order=relevance&title_only=0&
Fehler:
{"Cannot deserialize the current JSON object (e.g. {\"name\":\"value\"}) into type 'System.Collections.Generic.IEnumerable`1[Nitin.News.DAL.Resources.Article]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.\r\nTo fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.\r\nPath 'articles', line 1, position 12."}
mein Code wie folgt:
Danke für Ihre Antwort, aber leider bekomme ich die gleiche Fehlermeldung. –
@NitinJS tut mir leid das zu hören. Ich hatte den Code getestet und ging von Ihrem Fehler zur Lösung aus. Ich kann das vollständige Arbeitsprojekt hochladen, wenn Sie möchten? Hast du diese Codezeile geändert? esponse.Content.ReadAsAsync()? –
Hallo, Danke, Ihr Code hat funktioniert: D hat den Rückgabetyp von 'IEnumerable' in 'T' geändert. –