Description
Updated by @layomia:
There's a lot of overlap between this feature and field support wrt. public API proposal. See #34558 for combined API proposal and discussion.
Non-public setters for public properties are not used when deserializing. Other serializers have this feature. As a workaround, user's have to write custom converter's for such POCOs, which isn't trivial in case of a complex object. This feature provides an opt-in for the serializer to use non-public setters.
Enabling non-public getter usage is included for parity with Newtonsoft.Json
which supports this when the JsonProperty
attribute is used, and to prevent complicating the API surface if this is ever desired in the future.
This feature was scoped out of v1 (3.x), as the objective was to support simple POCOs. We elected to make this feature opt-in due to security concerns with non-public support.
This feature does not include support for non-public properties.
A related feature that allows deserialization of immutable objects through parameterized constructors was recently added in #33444.