ServiceStack.Text how to serialize class to JSon

前端 未结 3 955
深忆病人
深忆病人 2020-12-10 04:02

Just downloaded ServiceStack.Text to use it in my ASP.NET. I have class with many properties and would like to serialize five of them(string, integer, binary) to JSON. Could

3条回答
  •  醉梦人生
    2020-12-10 04:35

    servicestack's test proves that by providing the [DataContract] and [DataMember] attribute allows you to determine which one is being serialized and which doesn't.

    Test: https://github.com/ServiceStack/ServiceStack.Text/blob/master/tests/ServiceStack.Text.Tests/DataContractTests.cs

    objects in test: https://github.com/ServiceStack/ServiceStack.Text/blob/master/tests/ServiceStack.Text.Tests/Support/DdnDtos.cs

提交回复
热议问题