Here's what I'm trying to post to my ServiceStack web service:
$.ajax({
url: 'http://localhost:8092/profiles',
type:'POST',
data: {
FirstName : "John",
LastName : "Doe",
Categories : [ "Category 1", "Category 2", "Category 3" ]
},
success: function (response) { $('#response').append('Success!'); },
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status + ' Error: ' + thrownError);
},
dataType: "json"
});
And here's the destination class:
[Route("/profiles", "POST")]
public class ProfileRequest
{
public string FirstName{ get; set; }
public string LastName{ get; set; }
public string[] Categories{ get; set; }
}
All the fields are being populated except for the array. Can ServiceStack just not handle objects of this complexity or am I missing something?
Note: I've seen Unable to deserialize array which suggests using JSON.stringify() but that solution still doesn't seem to work, in fact it makes it worse by causing no data to be deserialized.