Reputation: 8960
I am getting error when I try to set DefaultSettings
of JsonConverter
.
JsonConverter.DefaultSettings = () => new JsonSerializerSettings()
{
ContractResolver = new DefaultContractResolver
{
NamingStrategy = new CamelCaseNamingStrategy()
}
};
So basically it does not find DefaultSettings in JsonConverter.
The weird thing is the same code was working earlier, I cleared the cache of the nuget package and restored them and then it stopped working
Now even when I see the metadata of the JsonConverter
I do not see the DefaultSettings
there
Upvotes: 0
Views: 950
Reputation: 81493
You have
JsonConvert`er`.DefaultSettings
You actually want JsonConvert.DefaultSettings
(minus the er
)
Gets or sets a function that creates default JsonSerializerSettings. Default settings are automatically used by serialization methods on JsonConvert, and ToObject () and FromObject(Object) on JToken. To serialize without using any default settings create a JsonSerializer with Create().
Example
JsonConvert.DefaultSettings = () => new JsonSerializerSettings()
{
ContractResolver = new DefaultContractResolver
{
NamingStrategy = new CamelCaseNamingStrategy()
}
};
Upvotes: 2