Is there a way to ignore default values during serialization with ServiceStack json? -
i using entity framework orm. has complextypeattribute
(which used annotate poco's). properties complex types, instantiated (using default constructor), regardless of value; , consequence, serialized servicestack jsonserializer
(along properties).
json.net has enum called defaultvaluehandling
, can used in these situations.
does servicestack have similar?
for example:
class person { string name { get; set; } address address { get; set; } } [complextype] class address { string street { get; set; } int number { get; set; } int postalcode { get; set; } }
when serialize person doesn't have address this:
"{ name: jim, address : { number: 0, postalcode: 0 } }"
in json.net if set defaultvaluehandling ignore, get
"{ name: jim }"
yes, here different ways can ignore properties servicestack's json , text serializers.
the serializers support multiple hooks customize serialization , deserialization.
the jsconfig class shows customizations possible.
json servicestack
No comments:
Post a Comment