I am trying to use an API that uses the following example structure for json returned
[ { "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 does a great job with something like the following structure
{ "customer": { ["field1" : "value", etc...], ["field1" : "value", etc...], } }
But I canβt understand how to make him be happy with the structure provided.
Using the standard JsonConvert.DeserializeObject (content) results in the correct number of clients, but all data is zero.
Performing something from the list of clients (below) results in the exception "Unable to deserialize the current JSON array"
public class CustomerList { public List<Customer> customer { get; set; } }
Thoughts?