1

Is it possible to make ServiceStack.Text sterilize public fields of a struct just like the .net JavaScriptSerializer does?

Currently if a struct does not define a filed as a property, i.e. property keyword in c++ or get;set; in c# the value does not get serialized.

Dmitry
  • 1,513
  • 1
  • 15
  • 33

1 Answers1

2

This is not currently possible with ServiceStack serializers.

By design ServiceStack serializers tries to promote the use of special purpose DTOs for use in the service layer/boundary of your services, in this goal we only serialize public properties of types which allows flexibility in how the wire format is generated.

This is opposed to being a general purpose object serializer that would also serialize the internal representation of your types (i.e. private and public fields).

mythz
  • 141,670
  • 29
  • 246
  • 390