반환 된 json에 대해 다음 예제 구조를 사용하는 API를 사용하려고합니다.
[
{
"customer":{
"first_name":"Test",
"last_name":"Account",
"email":"test1@example.com",
"organization":"",
"reference":null,
"id":3545134,
"created_at":"2013-08-06T15:51:15-04:00",
"updated_at":"2013-08-06T15:51:15-04:00",
"address":"",
"address_2":"",
"city":"",
"state":"",
"zip":"",
"country":"",
"phone":""
}
},
{
"customer":{
"first_name":"Test",
"last_name":"Account2",
"email":"test2@example.com",
"organization":"",
"reference":null,
"id":3570462,
"created_at":"2013-08-12T11:54:58-04:00",
"updated_at":"2013-08-12T11:54:58-04:00",
"address":"",
"address_2":"",
"city":"",
"state":"",
"zip":"",
"country":"",
"phone":""
}
}
]
JSON.net은 다음 구조와 같이 잘 작동합니다.
{
"customer": {
["field1" : "value", etc...],
["field1" : "value", etc...],
}
}
그러나 제공된 구조에 만족하도록하는 방법을 알 수 없습니다.
기본 JsonConvert.DeserializeObject (content)를 사용하면 고객 수가 정확하지만 모든 데이터가 null입니다.
CustomerList (아래)를 수행하면 "현재 JSON 배열을 역 직렬화 할 수 없음"예외가 발생합니다.
public class CustomerList
{
public List<Customer> customer { get; set; }
}
생각?