tl/dr;
Should both the column names in my db and JSON-Keys be camelCase
or
Should both the column names in my db and JSON-Keys be uppercase SNAKE_CASE
Long version
I'm designing a REST API that communicates with a sqlite database. I have been following some of the google styling guides, particularly the one for JSON. As it mentions, camelCase is the preferred style for JSON. I've also seen a comment where snake_case is up ~20% easier to read.
Currently, I have implemented functions to execute the SQL query, receive the result as a table object, then use json-smart to convert that to an actual JSON string.
The column names I've been using inside of the database are really upper SNAKE_CASE
, since the are only a few references to a standardized format for database column names. This upper SNAKE_CASE
column names become part of key-value pairs in the returned JSON.
So, since I'm at the very early stages of the design, does it seem reasonable to use camelCase column labels in my database or stick to the upper CAMEL_CASE
, thereby breaking the JSON standard? I don't want to convert the names after an sql query in the application as this would add un-needed complexity and potential performance hinderance.