JamesNK / Newtonsoft.Json

Json.NET is a popular high-performance JSON framework for .NET
https://www.newtonsoft.com/json
MIT License
10.8k stars 3.26k forks source link

Consider exposing getter #1595

Open danielwertheim opened 6 years ago

danielwertheim commented 6 years ago

Consider exposting the getter for ParameterizedCreator in JsonObjectContract just as its siblings e.g. OverrideCreator

https://github.com/JamesNK/Newtonsoft.Json/blob/master/Src/Newtonsoft.Json/Serialization/JsonObjectContract.cs#L96

E.g. useful if you want to write your own ContractResolver to support different constructors e.g. private, but see if the default behavior has found one already.

iberodev commented 5 years ago

This would be great to have. As per this stack overflow question: https://stackoverflow.com/questions/57030272/how-to-customize-value-setting-during-deserialization-with-contract-resolver-and

if there's a need of customizing deserialization into immutable objects (i.e: no public setters), the only way found was to get the parameterized constructor making some assumptions. This would be way easier if there was a getter for ParameterizedCreator (unless someone suggests other solution for customizing values during deserialization into immutable objects?)