northwind-demo icon indicating copy to clipboard operation
northwind-demo copied to clipboard

remove json camelCasing with .net core 3.0

Open graphicsxp opened this issue 4 years ago • 1 comments

Returning camelCasing JSON is now the default in net core 3.0. However, as shown in the sample app, the formatter is modified to return pascal casing as the casing is changed on the client side.

The thing is that everything still work fine if I remove that code

.AddNewtonsoftJson(opt => {
      // Set Breeze defaults for entity serialization
      var ss = JsonSerializationFns.UpdateWithDefaults(opt.SerializerSettings);
      if (ss.ContractResolver is DefaultContractResolver resolver)
      {
          resolver.NamingStrategy = null;  // remove json camelCasing; names are converted on the client.
      }
      ss.Formatting = Newtonsoft.Json.Formatting.Indented; // format JSON for debugging
  });

So is it needed ?

I'd like to return camelCase Json because I'm mixing up breeze and non-breeze controllers.

graphicsxp avatar Apr 07 '20 08:04 graphicsxp

That should be fine, as long as your client uses the same NamingConvention.

steveschmitt avatar Mar 19 '21 18:03 steveschmitt