我使用json2csharp以使模型适合json结构。
public class S
{
public int k { get; set; }
public string n { get; set; }
}
public class IOt
{
public int v { get; set; }
public S s { get; set; }
public string tn { get; set; }
}
public class S2
{
public int k { get; set; }
public string n { get; set; }
}
public class C
{
public int k { get; set; }
public string n { get; set; }
}
public class O
{
public List<string> ah { get; set; }
public List<string> ou { get; set; }
public List<string> odd12 { get; set; }
public List<string> ah1st { get; set; }
public List<string> ou1st { get; set; }
public List<string> odd121st { get; set; }
}
public class Pci
{
public int ctid { get; set; }
public int? pid { get; set; }
public string ctn { get; set; }
}
public class E
{
public bool dbg { get; set; }
public int egid { get; set; }
public string g { get; set; }
public List<object> i { get; set; }
public bool ibs { get; set; }
public bool ibsc { get; set; }
public int k { get; set; }
public object no { get; set; }
public O o { get; set; }
public object po { get; set; }
public Pci pci { get; set; }
public object pvdr { get; set; }
public string egn { get; set; }
}
public class Eg
{
public C c { get; set; }
public List<E> es { get; set; }
}
public class NOt
{
public int v { get; set; }
public S2 s { get; set; }
public List<Eg> egs { get; set; }
public string tn { get; set; }
}
public class RootObject
{
public int tp { get; set; }
public IOt iot { get; set; }
public NOt not { get; set; }
}
然后拨打电话
string json = System.IO.File.ReadAllText(@"D:\json.txt");
var data=JsonConvert.DeserializeObject<RootObject>(json);
所有对象的数据始终为null。我做错了吗?