I'm using the latest version of RestSharp, from NuGet. I'm querying an API that returns a JSON dictionary in which the keys cannot be hard coded into a C# class before-hand. The keys are not known, coming from the API.
I'm following the recommended usage pattern outlined on the RestSharp Wiki here:https://github.com/restsharp/RestSharp/wiki/Recommended-Usage.
I tried calling Execute so that it looks like this: Execute>(request). This throws an error saying that it cannot convert a JSON array into that Dictionary, though. The exact exception is as follows ...
Unable to cast object of type 'RestSharp.JsonArray' to type
'System.Collections.Generic.IDictionary`2[System.String,System.Object]'.And the HTTP response from the API looks like this ...
{
"108" : {
"name" : "Malzahar's Captains",
"tier" : "SILVER",
"queue" : "RANKED_SOLO_5x5"
}
}Any ideas?
--
You received this message because you are subscribed to a topic in the Google Groups "RestSharp" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/restsharp/38x3tR1KztA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to restsharp+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
{ "108" : { "name" : "Malzahar's Captains", "tier" : "SILVER", "queue" : "RANKED_SOLO_5x5" } }
public class __invalid_type__108
{
public string name { get; set; }
public string tier { get; set; }
public string queue { get; set; }
}
public class RootObject
{
public __invalid_type__108 __invalid_name__108 { get; set; }
}