Closed ganySA closed 5 years ago
Just to be clear what you want: Something is PascalCase in .net, and you want it to be camelCase when it is JSON serialized, right?
There is this line from your code above:
res.NamingStrategy = null; // <<!-- this removes the camelcasing
Are you saying that it doesn't work with that line, or without that line, or in neither case?
They are removing Newtonsoft so they have two configuration options.
The solution is to use AddNewtonsoftJson(opt ==>....) and not AddJsonOptions(opt ==>
AddJsonOptions will use the new microsoft json formatter.
solution in previous post.
Thanks!
or :
services.AddControllers().AddNewtonsoftJson(options =>
{
options.SerializerSettings.ReferenceLoopHandling =
Newtonsoft.Json.ReferenceLoopHandling.Ignore;
options.UseMemberCasing(); // Use property name instead of default camelcase
}
);
Previously using breeze .net core with .net core 2.2 i could do the following to ensure breeze worked in camelcase mode. However now JsonSerializationFns.UpdateWithDefaults(opt.SerializerSettings);
No longer works given the shift from the Json Serializer to new .net one?
Any ideas?