We're using JSON.NET to convert a tiered object into JSON, then from there into XML.
We're aware of the arguments against doing this, but there are several arguments in favor of it, and we've tried a lot of things to get here.
An issue we're running into is that occasionally a property will have a null value. When the property is getting converted to an element, that's fine, but when it's an attribute, we get a NullReferenceException
thrown. Our preference would be to have nulls get converted to empty strings, however leaving them out entirely would be acceptable.
How can we handle this?