Having a problem deserializing JSON data, can't seem to pin down the issue?

144 views
Skip to first unread message

Scott Stamp

unread,
May 20, 2013, 4:58:11 PM5/20/13
to rest...@googlegroups.com
Hi everyone, I'm working with a JSON API that's feeding me back an array of music track information, but for some reason I can't deserialize the data with RestSharp.

Here's a pastebin of the JSON Data (prettified with JSONLint): http://pastebin.com/z17mA9Un
Here's the struct I've written to deserialize the data: http://pastebin.com/yK9rMfT4

For some reason my code isn't populating the featured, popular, and hot structures. Any ideas or suggestions would be greatly appreciated. If anyone needs more information please ask, I'm not really sure what to include for debugging purposes.

Thanks all,
--
Scott Stamp

Pete Johanson

unread,
May 20, 2013, 5:18:51 PM5/20/13
to rest...@googlegroups.com

There's a lot going on here... Quick scan looks pretty good. Have you inspected the IRestResponse.ErrorMessage or ErrorException? (IIRC, only have my phone in front of me). They usually have details about deserialization errors.

-pete

--
You received this message because you are subscribed to the Google Groups "RestSharp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to restsharp+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Scott Stamp

unread,
May 20, 2013, 5:34:27 PM5/20/13
to rest...@googlegroups.com
Thanks for the tip, but both the exception and the message are null. Not sure what's going on.

Patrick Steele

unread,
May 25, 2013, 10:45:56 AM5/25/13
to rest...@googlegroups.com
See what http://json2csharp.com/ produces.  Maybe there's something wrong with your C# classes (from cursory glance, it looks okay).

Thomas Vriens

unread,
May 29, 2013, 5:33:07 AM5/29/13
to rest...@googlegroups.com
http://jsonformatter.curiousconcept.com/ indicates a problem when compacting the JSON. Might want to look at that.

Op maandag 20 mei 2013 22:58:11 UTC+2 schreef Scott Stamp het volgende:

Thomas Vriens

unread,
May 29, 2013, 7:06:36 AM5/29/13
to rest...@googlegroups.com
Checked your provided classes and json further. It's normal it doesn't work. First you should correct the problem at the end of your json and secondly you model was missing a layer in regard to your JSON structure.

Check here for the updated json and model boxed together in a quick test app: http://pastebin.com/AgkJTaHf

Op woensdag 29 mei 2013 11:33:07 UTC+2 schreef Thomas Vriens het volgende:
Reply all
Reply to author
Forward
0 new messages