There’s no JS configuration that lets you configure this behavior, the only 2 generic solutions I can think of is similar to @daleholborow link of registering a Response Filter that uses reflection to generically go through each property and replace each empty string with null.
The other solution is to add a ShouldSerialize() API on POCOs you want this behavior on to ignore any string properties with null or empty values, e.g:
public class Poco {
public bool? ShouldSerialize(string name) => this.IgnoreEmptyStrings(name);
}
public static class MyExt
{
public static bool? IgnoreEmptyStrings<T>(this T obj, string name)
{
var accessor = TypeProperties.Get(typeof(T)).GetAccessor(name);
return accessor?.PropertyInfo.PropertyType == typeof(string)
? !string.IsNullOrEmpty((string)accessor.PublicGetter(this))
: (bool?)null;
}
}