c# - How to load matches.json with RestSharp

c# - How to load matches.json with RestSharp

in API Development

Posted by: quenoz.3859

quenoz.3859

I tried with client.Execute<List<Match>>(request), but List<Match> does not seem to work. I must be missing something very obvious, can you guys point me into the right direction?

my match class:

public class Match
{
public string WvwMatchId
{ get; set; }
public int RedWorldId
{ get; set; }
public int BlueWorldId
{ get; set; }
public int GreenWorldId
{ get; set; }

}

The Unlikely Plan [TUP] Raid Leader

c# - How to load matches.json with RestSharp

in API Development

Posted by: Ruhrpottpatriot.7293

Ruhrpottpatriot.7293

You have to deserialize into Dictionary<string, List<Matches>> as the matches.json does not return a pure array but a type which has an array as sub type (some inconsistency in the api here).

However as you seem to work on a .Net implementation of the array I invite you to join us over at GW2.Net (Codeplex site)

Administrator of GW2.NET: GitHub , Forum , NuGet

c# - How to load matches.json with RestSharp

in API Development

Posted by: quenoz.3859

quenoz.3859

ah, thanks for the explanation.

guess i will start using the gw2.net, ty for the hint!

The Unlikely Plan [TUP] Raid Leader

c# - How to load matches.json with RestSharp

in API Development

Posted by: Ruhrpottpatriot.7293

Ruhrpottpatriot.7293

You are welcome. However we have not yet included the WvW (or only a very basic proof of concept). You are welcome to join us in the development process.

Administrator of GW2.NET: GitHub , Forum , NuGet

c# - How to load matches.json with RestSharp

in API Development

Posted by: poke.3712

poke.3712

You can also create another type that just holds your results, as I did here with the EventList type.

E.g.

public class MatchList
{
    public List<Event> WvwMatches
    { get; set; }
}
@poke // GW2W //