Javascript community generally follows camel case naming convention, whereas while writing REST api URLs follow snake case naming conventions.

What would be the better naming convention for the payloads which will be sent in HTTP requests/responses?

If the answer is snake_case then will it be better to convert each and every key in the payload to be converted to snake case while going out of the Node JS server and be converted to camelCase while coming into the Node JS server and should same be followed on the client side if it is also using JS environment?


1 Answer 1


The underlying transport method of an API should be hidden by a Client class.

A JavaScript Client will of course expose methods which follow the javascript naming conventions.


function niceCamelCaseFunctionName()
        function(response) {
          response.json().then(function(data) {
            var r = {
               niceProperty : data.EvilPascalCase
            return r

Not the answer you're looking for? Browse other questions tagged or ask your own question.