Answer the question
In order to leave comments, you need to log in
How to deserialize json with complex body?
Sending this JSON via Postman, how to parse partnerAddress data
{
"partnerGUID": "GUID", "parentGUID"
: GUID,
"partnerName": "NAME",
"partnerCode": "00-CODE",
"partnerAddress": [
{
" type": "Address",
"country": "RUSSIA",
"region": null,
"city": null,
"view": "fsdfsd"
}
]
}
Created such classes, it doesn't help, what is wrong?
[DataContract]
public class JsonData
{
[DataMember(Name = "партнерАдреса")]
public AdressData Adress { get; set; }
}
public class AdressData
{
[DataMember(Name = "тип")]
public string Type { get; set; }
[DataMember(Name = "страна")]
public string Country { get; set; }
[DataMember(Name = "регион")]
public string Region { get; set; }
[DataMember(Name = "город")]
public string City { get; set; }
[DataMember(Name = "представление")]
public string Perfomance { get; set; }
}
Answer the question
In order to leave comments, you need to log in
"родительGUID": GUID,
- quotation marks are missing here.
{
"партнерGUID":"GUID",
"родительGUID":"GUID",
"партнерНаименование":"NAME",
"партнерКод":"00-CODE",
"партнерАдреса":[
{
"тип":"Адрес",
"страна":"РОССИЯ",
"регион":null,
"город":null,
"представление":"fsdfsd"
}
]
}
public class ПартнерАдреса
{
public string тип { get; set; }
public string страна { get; set; }
public object регион { get; set; }
public object город { get; set; }
public string представление { get; set; }
}
public class Root
{
public string партнерGUID { get; set; }
public string родительGUID { get; set; }
public string партнерНаименование { get; set; }
public string партнерКод { get; set; }
public List<ПартнерАдреса> партнерАдреса { get; set; }
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question