Reputation: 1708
I have a number of legacy services in a ServiceStack 3 based middleware application which use the default date serialization format for JSON. The issue is that this is not human readable for debugging.
I would like a new service that is being tested to have human readable dates, which the ISO8061 format can do.
How can I change, for ServiceStack 3, the JSON date serialization format for a single service or on a service by service basis? I don't want to have to revalidate the consumers for all legacy services with a new date format.
....
Note: I have found an answer for ServiceStack 4, but the option to create a ResponseScope on an HttpResult does not seem to exist in ServiceStack 3.
Upvotes: 1
Views: 281
Reputation: 131364
Looking at the source of JsConfig and similar SO questions I see that you can use a JsConfigScope to limit the scope of Json settings. Perhaps you can write something like :
using(var config = JsConfig.With(dateHandler=JsonDateHandler.ISO8601))
{
...
}
Upvotes: 2