Is it posible to define serializer for ToJson method for the new feature in entity framework core "Mapping to JSON Columns"
Class:
public class MyClass {
public string MyInnerPropety{ get; set; }
}
Inside context model builder
builder.OwnsOne(m => m.MyClassProperty, ownedNavigationBuilder =>{
ownedNavigationBuilder.ToJson();
});
Currently as default serializer is serializing as CapitalCase I would like to use camelCase for property names since that is JSON standard and I am not sure why MS is pushing it to be CapitalCase but that is issue for another question.
Current:
{ "MyInnerPropety": "Test"}
Wanted:
{ "myInnerPropety": "Test"}
CodePudding user response:
You could try add JsonPropertyName
attribute on the attribute or configure in
OnModelCreate method