Given this request DTO
public class CreateRecordRequest {
public Dictionary<string, object> Record { get; set; }
}
when I call the service passing this JSON
{
"Record": {
"File": {
"name": "DSC_3493_4_5.jpg",
"extension": ".jpg",
"size": 596002,
"rawFile": {}
},
"Notes": "",
"Type": ""
}
}
File
has the deserialized value "{"
. Since ServiceStack has no way of knowing which object File
maps to, I'm curious why it doesn't deserialize it as a dictionary ("{"
is inexplicable). What is the easiest way to customize deserialization of a single value like this? I'm working with Kendo's upload control and this is the JSON it submits.
Because it's an object
the Serializer doesn't know what type to dehydrate this into, you can force it to use a Dictionary<string,string>
with:
JsConfig.ConvertObjectTypesIntoStringDictionary = true;