My server is using ServiceStack and would like to receive some data like this:
{
Customer: {
Company: \"TheCompany\",
RegionCode: \"AU_NS
ServiceStack can POST complex types using the JSV Format, e.g:
Otherwise you can send complex types using JSON, e.g. with jQuery's $.ajax:
$.ajax({
type: 'POST',
contentType: 'application/json; charset=utf-8',
url: "http://host/myservice",
dataType: 'json',
data: JSON.stringify({Customer:{Company:'x',RegionCode:'x'}}),
success: function(response){ ... }
});
Although for maximum interoperability you should strive to keep your Request DTO's flat, e.g:
Which you can then POST as-is which the browser will do using the x-www-form-urlencoded
Content-Type, or even ajaxify using ServiceStack's ss-utils.js bindForm method, e.g:
$("#theForm").bindForm();