General
camelCase, snake_case and kebab-case: Which One, and How to Convert Safely
Table of contents
The convention mapThe acronym problem nobody warns you aboutWhy conversion can lose informationThe conversion checklistFrequently Asked QuestionsCasing looks cosmetic until it crosses a boundary. A JSON key renamed from
Python variables and functions use snake_case, classes use PascalCase, and constants use SCREAMING_SNAKE_CASE. JavaScript and TypeScript use camelCase for variables and functions, PascalCase for components and types. Go uses PascalCase for exported identifiers and camelCase for unexported ones, and the capital letter is the access modifier rather than a style choice. CSS properties and class names use kebab-case, and so do URLs and file slugs.
SQL leans on snake_case, though plenty of legacy schemas disagree.
Case conversion is not reversible in general.
Data keys in a payload you control end to end. Test fixture names. Documentation examples. Anything generated once and reviewed.
Database columns, environment variable names, public API fields, and anything already persisted. Renaming a JSON field is an API version bump, not a refactor.
Confirm the target convention from the surrounding code, not from a blog post.
Check for acronyms and digits, then verify the output by eye.
Search for string occurrences before renaming an identifier, because config files and templates do not follow the compiler.
Update tests and fixtures in the same commit.
Lint's Case Converter converts between camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, and title case in one pass, and shows the original alongside the result so acronym damage is visible before you paste it back.
Q: Which case should JSON keys use?
There is no universal rule. Most JavaScript APIs use camelCase, most Python APIs use snake_case. Follow whichever the consumer already uses, and never change it without a version bump.
Q: Why did my identifier become Http instead of HTTP?
Because the converter treats capitalised runs as single words. Acronyms need manual handling or a converter that preserves consecutive capitals.
Q: Is kebab-case valid in JavaScript?
Not for identifiers, because the hyphen parses as subtraction. It is fine for CSS classes, HTML attributes, file names, and URL paths.
Q: Can it convert a whole file?
Convert name by name. Bulk conversion breaks string literals, imports, and config keys that the compiler never sees.
user_id to userId is a silent null in production, not a style preference. Knowing which convention belongs where prevents a whole class of integration bugs.The convention map
Python variables and functions use snake_case, classes use PascalCase, and constants use SCREAMING_SNAKE_CASE. JavaScript and TypeScript use camelCase for variables and functions, PascalCase for components and types. Go uses PascalCase for exported identifiers and camelCase for unexported ones, and the capital letter is the access modifier rather than a style choice. CSS properties and class names use kebab-case, and so do URLs and file slugs.
SQL leans on snake_case, though plenty of legacy schemas disagree.
The acronym problem nobody warns you about
HTTPResponseParser, httpResponseParser, parseHTTPResponse, and parse_http_response are four spellings of the same idea, and most converters handle only one of them. Round-tripping a name through a converter can produce HttpResponseParser from HTTPResponseParser, which then fails a snapshot test. When a name contains an acronym, convert it by hand or verify the output character by character.Why conversion can lose information
Case conversion is not reversible in general.
userid has no word boundary, so a converter must guess between user_id and use_rid. HTTPSProxy and http_s_proxy produce the same snake output from different inputs. That is why converting identifiers across a boundary should be a deliberate rename with a migration, not a bulk sed.Where it is safe
Data keys in a payload you control end to end. Test fixture names. Documentation examples. Anything generated once and reviewed.
Where it is dangerous
Database columns, environment variable names, public API fields, and anything already persisted. Renaming a JSON field is an API version bump, not a refactor.
The conversion checklist
Lint's Case Converter converts between camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, and title case in one pass, and shows the original alongside the result so acronym damage is visible before you paste it back.
Frequently Asked Questions
Q: Which case should JSON keys use?
There is no universal rule. Most JavaScript APIs use camelCase, most Python APIs use snake_case. Follow whichever the consumer already uses, and never change it without a version bump.
Q: Why did my identifier become Http instead of HTTP?
Because the converter treats capitalised runs as single words. Acronyms need manual handling or a converter that preserves consecutive capitals.
Q: Is kebab-case valid in JavaScript?
Not for identifiers, because the hyphen parses as subtraction. It is fine for CSS classes, HTML attributes, file names, and URL paths.
Q: Can it convert a whole file?
Convert name by name. Bulk conversion breaks string literals, imports, and config keys that the compiler never sees.
📌 Prices and tool count in this article may be outdated. Lint now ships 16 tools with Pro at $12/mo, or $60/year. See the current pricing page.
Stop letting Grammarly break your code
17 AI tools built for developers. Code-aware parsing.
Or upgrade to Pro for 500 checks a day · All tools · No ads