Home > Net >  How to read the multilayer json serialization into a layer of objects
How to read the multilayer json serialization into a layer of objects

Time:12-10

 {
"Status" : "success",
"Data" : {
"Block_no" : 0,
"Time" : 1231006505,
"Confirmations" : 660591
}
}
for example, I want the time switch to objects in the data and the data level, rather than superior and how to write the
 
class query{
[JsonProperty (" status ")]
Public string state {get; set; }
[JsonProperty (" time ")]
Public time {get; set; }
}
this is wrong?

CodePudding user response:

refer to the original poster Chinese naming advocates response:
 {
"Status" : "success",
"Data" : {
"Block_no" : 0,
"Time" : 1231006505,
"Confirmations" : 660591
}
}
for example, I want the time switch to objects in the data and the data level, rather than superior and how to write the
 
class query{
[JsonProperty (" status ")]
Public string state {get; set; }
[JsonProperty (" time ")]
Public time {get; set; }
}
this is wrong?


Write like this,

CodePudding user response:

reference 1st floor icoolno1 response:
Quote: refer to the original poster Chinese naming advocates response:
 {
"Status" : "success",
"Data" : {
"Block_no" : 0,
"Time" : 1231006505,
"Confirmations" : 660591
}
}
for example, I want the time switch to objects in the data and the data level, rather than superior and how to write the
 
class query{
[JsonProperty (" status ")]
Public string state {get; set; }
[JsonProperty (" time ")]
Public time {get; set; }
}
this is wrong?


I'll write,
no, so didn't get to the second floor in the json data in the key,

CodePudding user response:

refer to the second floor Chinese naming advocates response:
Quote: refer to 1st floor icoolno1 response:
Quote: refer to the original poster Chinese naming advocates response:
 {
"Status" : "success",
"Data" : {
"Block_no" : 0,
"Time" : 1231006505,
"Confirmations" : 660591
}
}
for example, I want the time switch to objects in the data and the data level, rather than superior and how to write the
 
class query{
[JsonProperty (" status ")]
Public string state {get; set; }
[JsonProperty (" time ")]
Public time {get; set; }
}
this is wrong?


I'll write,
no, so didn't get to the second floor in the json data in the key value,


That is another problem, you need to define a type corresponding to the data attribute,
  •  Tags:  
  • C#
  • Related