Newtonsoft JsonSerializer – Lower case properties and dictionary [duplicate]

You could try using the CamelCasePropertyNamesContractResolver.

var serializerSettings = new JsonSerializerSettings();
serializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
var json = JsonConvert.SerializeObject(product, serializerSettings);

I’m just not sure how it’ll handle the dictionary keys and I don’t have time right this second to try it. If it doesn’t handle the keys correctly it’s still worth keeping in mind for the future rather than writing your own custom JSON writer.

Leave a Comment