A
A
asdz2016-06-01 16:47:18
JavaScript
asdz, 2016-06-01 16:47:18

What naming conventions do you follow when exchanging JSON data with the ASP.NET backend?

The JS Style guide says that methods and properties must be in camelCase, but in models received from the server, we get PascalCase. Which way do you choose:

  1. Do everything in js in camelCase, and leave the model in PascalCase?
  2. When serializing to json, convert PascalCase to camelCase?
  3. Don't use naming conventions from js style guide and do everything in PascalCase?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dvig8xi, 2016-06-01
@dvig8xi

1st
Registered in WebApiConfig and forgot

config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question