1

I try to make a connection with RouteXL but in the api response i get a json who is maybe invalid.

From the tag route he send a sort of array starting with a string index. Normally i convert this to a class (http://json2csharp.com) but with this json i get a invalid class structure because of the string index.

Before i go to split it by myself. You guys have a better solution?

With regards,

SirNirido

json:

{ 
    "id": "6VTa8zH8",
    "count":5,
    "feasible":true,
    "route": {
        "0": { "name": "StartLocatie", "arrival":0, "distance":0},
        "1": { "name": "58", "arrival":28, "distance":47.7},
        "2": { "name": "57", "arrival":42, "distance":65.3},
        "3": { "name": "56", "arrival":47, "distance":68.5},
        "4": { "name": "StartLocatie", "arrival":61, "distance":87.1}}}
SirNirido
  • 11
  • 1

1 Answers1

0

Thanks @JonSkeet it works like a charm.

It's a hard one for google. But if anyone ever have the sameproblem here is my new class schema

class Results
    {
        public string id { get; set; }
        public int count { get; set; }
        public bool feasible { get; set; }
        public Dictionary<string, RouteResult> route { get; set; }
    }
  public class RouteResult
    {
        public string index { get; set; }
        public string name { get; set; }
        public int arrival { get; set; }
        public double distance { get; set; }
    }
SirNirido
  • 11
  • 1