简体   繁体   中英

JSON.NET Deserialize nameless attributes with nested object

I've the following JSON:

{
    seq:108,
    d: 
    {
        s:'0',
        p:0,
        st:'ftt',
        time:153
    },
    h:[
        [287720,'James J.',0],
        [54421,'Martin M.',0],
        [54028,'Sara S.',0]
      ],
    e:[
        [2,9,252223,'Raul B.',4,{d:85124}],
        [2,28,287748,'Luis Y.',2,{}],
        [1,32,287746,'Ramiro L.',2,{}],
        [1,41,287719,'Franco T.',2,{}],
        [1,51,12295,'Marcos G.',4,{d:287746}],
        [1,57,287715,'Michael O\'Neal C.',4,{d:48191}]
      ]
}

And I've following classes to deserialize this JSON:

public class SModel
{
    public string seq { get; set; }
    public DModel d { get; set; }
    public List<List<string>> h { get; set; }
    //public List<List<string>> e { get; set; }
}

public class DModel
{
    public string s { get; set; }
    public string p { get; set; }
    public string st { get; set; }
    public int time { get; set; }
}

I am getting problem deserializing "e" in JSON. It's List<List<T>> and each T has and object in it. I need some guidance to write my classes to deserialize this JSON.

What you can do is change the public List<List<string>> e {get; set;} public List<List<string>> e {get; set;} to object

For Example:

public List<List<object>> e { get; set; }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM