Reputation: 97
I have a very simple ServiceStack service which I am invoking it via JSONServiceClient
and c# typed API.
However, when I have empty arguments in Request
params, ServiceStack is deserializing this into null values. I have looked and it seems like in JSV it is by design but JSON should retain non null values as they are. I have now also set following two settings in Global.asax.cs
but with no improvement:
JsConfig.IncludeNullValues = true;
JsConfig.ThrowOnDeserializationError = true;
I'm using ServiceStack version 3.9.69 and IIS version 8.0.
Upvotes: 0
Views: 872
Reputation: 3593
Do you need to differentiate between Null and Empty Strings? If not, then treat them as the same thing, you can check for them using string.IsNullOrEmpty(string str)
From a quick Google of the issue, it seems as a known problem, so you are going to need to work around it. Perhaps before serializing the, configure null values to a string "NULL"?
Upvotes: 0