c# - Strange Json deserialize -


i try make connection routexl in api response json maybe invalid.

from tag route send sort of array starting string index. convert class (http://json2csharp.com) json invalid class structure because of string index.

before go split myself. guys have 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}}} 

thanks @jonskeet works charm.

it's hard 1 google. if ever have sameproblem here 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; }     } 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -