Remove concrete __type information in JSON Response using JsonSerializer

前端 未结 1 1513
一整个雨季
一整个雨季 2021-02-20 00:11

How do you force the __type information from rendering in the deserialized JSON response? I have no need to reserialize this data so I\'d prefer to remove it. ServiceStack see

1条回答
  •  名媛妹妹
    2021-02-20 00:49

    By default the __type is only emitted when it's required for deserialization, e.g. your DTO contains an interface, abstract class or late-bound object type, etc.

    You can prevent it from ever being emitted with:

    JsConfig.ExcludeTypeInfo = true;
    

    Otherwise you can always emit it with:

    JsConfig.IncludeTypeInfo = true;
    

    0 讨论(0)
提交回复
热议问题