I am wondering how you can use custom JSON Serializer in ServiceStack. I know JsConfig.SerializeFn / DeSerializeFn, but they always seem to be "JSON.stringify" the result of my custom Serializer.
I like replacing serialization for the whole DTO. The end result should be something like
{"Name":"Greg"}
but not
"{\"Name\":\"Greg\"}"
Is it possible?
In terms of other Serializer ServiceStack JSON hooks, there is also JsConfig<T>.RawSerializeFn and JsConfig<T>.RawDeserializeFn that should do what you need.
JsConfig<T>.RawSerializeFn
JsConfig<T>.RawDeserializeFn
Otherwise, if you just want some pre / post processing to also execute the custom interceptors JsConfig<T>.OnSerializingFn and JsConfig<T>.OnDeserializedFn .
JsConfig<T>.OnSerializingFn
JsConfig<T>.OnDeserializedFn
Did you mean to use ServiceStack.Text.JsonSerializer.SerializeToString(object, typeof(object)) ? If you use it as .net, you may need to use Html.Raw(ServiceStack.Text.JsonSerializer.SerializeToString(object, typeof(object))) .
ServiceStack.Text.JsonSerializer.SerializeToString(object, typeof(object))
Html.Raw(ServiceStack.Text.JsonSerializer.SerializeToString(object, typeof(object)))