[英]Nested Json Convert to Class C#
我需要此json对象b的数组中的第一项。
{
"error":[],
"result":{
"XXRPXXBT":{
"a":[
"0.000084280",
"123",
"123.000"
],
"b":[
"0.000084120",
"24263",
"24263.000"
],
"c":[
"0.000084140",
"772.40225814"
],
"v":[
"1002684.00590349",
"1081301.61838716"
],
"p":[
"0.000085783",
"0.000085799"
],
"t":[
731,
866
],
"l":[
"0.000083420",
"0.000083420"
],
"h":[
"0.000086610",
"0.000086720"
],
"o":"0.000086300"
}
}
}
有人可以告诉我,类属性如何达到该级别。 我已经尝试过使用字符串对json进行反序列化,但是转换失败。
我不必将所有值都仅作为b数组中的第一项。
这是我所做的:
TestResponse deserializedKrakenResult = JsonConvert.DeserializeObject<TestResponse>(json);
public class TestResponse
{
public string[] result { get; set; }
}
和
public class TestResponse
{
public object[] result { get; set; }
}
和
public class TestResponse
{
public string result { get; set; }
}
进行这些操作只是为了使其解析。
Paste Json as Classes
结果如下:
public class Rootobject
{
public object[] error { get; set; }
public Result result { get; set; }
}
public class Result
{
public XXRPXXBT XXRPXXBT { get; set; }
}
public class XXRPXXBT
{
public string[] a { get; set; }
public string[] b { get; set; }
public string[] c { get; set; }
public string[] v { get; set; }
public string[] p { get; set; }
public int[] t { get; set; }
public string[] l { get; set; }
public string[] h { get; set; }
public string o { get; set; }
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.