Try the Case Converter

Why Your Database Uses snake_case, Your JSON Uses camelCase, and Your .env Uses SCREAMING_SNAKE_CASE — and What Breaks When You Mix Them

Database column names, JSON fields, environment variables, and CSS classes each use different casing conventions — and each choice reflects a constraint from where that identifier is used. Here's why PostgreSQL lowercases your column names, the JSON snake_case vs camelCase cross-ecosystem problem, why environment variables are SCREAMING_SNAKE_CASE, and the file-name case-sensitivity bug that works on macOS and breaks on Linux production servers.

June 21, 2026 6 min read
Share: Facebook WhatsApp LinkedIn Email
Why Your Database Uses snake_case, Your JSON Uses camelCase, and Your .env Uses SCREAMING_SNAKE_CASE — and What Breaks When You Mix Them

Database column names, CSS class names, and URL paths don't just happen to use different casing conventions — each choice reflects a constraint from the environment where that identifier will be used, and mixing conventions across a codebase creates maintenance debt that compounds invisibly until it suddenly matters

The previous articles on this site covered code naming conventions, Unicode case challenges, title case style guide differences, and case sensitivity in login systems. This article addresses case conventions in data systems — specifically why database identifiers, JSON field names, and environment variables each have their own conventions, and what breaks when you ignore them.


Database identifiers: the case-sensitivity landmine

SQL databases handle identifier case differently depending on the database system:

PostgreSQL: converts unquoted identifiers to lowercase automatically — CREATE TABLE Users creates a table named users. If you then query SELECT * FROM "Users" (quoted), you'll get "table not found" because the actual table is named users. This trips up developers migrating from case-insensitive databases or ORMs that quote identifiers.

MySQL/MariaDB: case sensitivity for table names depends on the operating system and the lower_case_table_names setting. On Linux, table names are case-sensitive by default; on Windows and macOS, they're case-insensitive. A codebase developed on macOS where Users and users are the same table can fail on a Linux production server where they're different tables.

SQL Server: case sensitivity is controlled by the database collation — a database with a case-sensitive collation (Latin1_General_CS_AS) treats Users and users as different; one with a case-insensitive collation (Latin1_General_CI_AS) treats them as the same.

The convention that avoids most of these problems: use lowercase snake_case for all database identifiers (user_accounts, order_line_items) — lowercase identifiers behave consistently across databases and operating systems.


JSON field names: why APIs are inconsistently cased and what it costs

JSON has no specified convention for field naming. Different ecosystems have settled on different conventions:

camelCase (firstName, lastName, orderId): standard in JavaScript, TypeScript, and APIs designed for JavaScript clients. JSON.parse in JavaScript produces objects whose properties are accessed with dot notation where camelCase is the natural convention.

snake_case (first_name, last_name, order_id): standard in Python, Ruby, and APIs designed for these ecosystems. Python's naming convention makes snake_case the natural choice.

PascalCase (FirstName, LastName, OrderId): used in some .NET and C# APIs where the convention matches C# property naming.

The cross-ecosystem problem: a Python backend returning snake_case JSON consumed by a JavaScript frontend requires either: client-side conversion (transforming first_namefirstName in the JavaScript layer), or accepting the mismatch and using response.first_name instead of response.firstName in JavaScript (inconsistent with JavaScript convention).

Many frameworks provide automatic case conversion (Python's Django REST Framework, Pydantic with alias_generator, JavaScript clients using camelcase libraries) — but this introduces a mapping layer that can become a source of bugs when the transformation is partial or inconsistent.


Environment variables: SCREAMING_SNAKE_CASE and why

Environment variables are almost universally SCREAMING_SNAKE_CASE (DATABASE_URL, AWS_SECRET_ACCESS_KEY, MAX_RETRY_ATTEMPTS) — all uppercase, words separated by underscores.

The reason is partially historical (Unix shells are case-sensitive, and uppercase was conventionally used for environment variables to distinguish them from shell variables) and partially practical — environment variables must be safe to use in shell scripts, where a variable named database-url (with a hyphen) would be interpreted as database minus url in arithmetic context. Underscores are the only safe word separator in shell variable names.

The convention is effectively universal enough that frameworks, deployment platforms (Kubernetes, Docker, Heroku, Fly.io), and secret managers all expect environment variables in SCREAMING_SNAKE_CASE. Deviating from this creates friction with tooling.


File names: the OS-level case problem

File name case sensitivity follows the operating system's filesystem:

macOS HFS+/APFS (default): case-insensitive (but case-preserving) — Component.tsx and component.tsx cannot coexist in the same directory, and import './Component' and import './component' both work.

Linux ext4/XFS: case-sensitive — Component.tsx and component.tsx are different files; import './component' fails if the file is named Component.tsx.

The cross-platform development problem: a React component file named MyComponent.tsx imported as import MyComponent from './mycomponent' works on macOS (case-insensitive filesystem) but fails on the Linux production server. This is a class of bug that doesn't appear in development and only manifests in deployment — notoriously frustrating to debug the first time it occurs.

The standard solution: be consistent with capitalization in both the file name and the import path, and enforce this with linting tools (ESLint's import/no-unresolved rule or TypeScript's forceConsistentCasingInFileNames option flag inconsistencies).


CSS class names: why BEM uses dashes and why that matters

CSS class names use kebab-case (primary-button, card-header, nav-link) — all lowercase, words separated by hyphens.

The reason: CSS property names themselves use kebab-case (background-color, font-size, margin-top), and HTML attributes are case-insensitive. Using camelCase in class names (primaryButton) works but is inconsistent with the surrounding language conventions; using PascalCase (PrimaryButton) is meaningfully inconsistent and reads as unusual.

BEM methodology (Block, Element, Modifier) doubles down on kebab-case within segments: .card__card-header--highlighted — using double underscores for element relationships and double hyphens for modifiers.

CSS Modules (common in React/Vue component-based development) allow camelCase class names used in JavaScript (styles.primaryButton) mapped to kebab-case in the generated CSS — providing the best of both: JavaScript-native naming in JS code, CSS-native naming in stylesheets.


How to use the Case Converter on sadiqbd.com

  1. For cross-system naming: convert a natural-language name to the appropriate convention for each context — "user account order" → user_account_order for database columns, userAccountOrder for JavaScript variables, USER_ACCOUNT_ORDER for environment variables, user-account-order for CSS and URLs
  2. For API integration: when consuming an API with a different naming convention than your code uses, the converter helps plan the field-name translation between systems
  3. For code review preparation: identify inconsistencies in a proposed field-naming scheme by converting between conventions and checking for collisions or ambiguities

Frequently Asked Questions

Is there a "best" single convention that works across all systems? No — the optimal convention is system-specific, and trying to use one convention universally means fighting against at least some environments' natural grain. The practical goal is consistency within each system (all database columns use snake_case, all JavaScript variables use camelCase, all environment variables use SCREAMING_SNAKE_CASE) and explicit, automated transformation at boundaries between systems (API responses auto-converted from snake_case to camelCase, ORM field mappings handled by the framework). Attempting to use camelCase in database column names or kebab-case in environment variables creates friction with tooling and convention for no benefit.

Is the Case Converter free? Yes — completely free, no sign-up required.

Try the Case Converter free at sadiqbd.com — convert any text between camelCase, snake_case, SCREAMING_SNAKE_CASE, kebab-case, PascalCase, and more.

Share: Facebook WhatsApp LinkedIn Email

Case Converter

Free, instant results — no sign-up required.

Open Case Converter →
Similar Tools
Morse Code Translator Text Truncator Text Reverser Character Frequency Text to Slug Lorem Ipsum Generator Find & Replace String Repeater
Code Naming Conventions: Why camelCase, snake_case, and kebab-case Each Exist
Text Tools
Code Naming Conventions: Why camelCase, snake_case, and kebab-case Each Exist
Unicode Case Conversion Challenges: The Turkish I Problem, German ß, and Locale-Aware APIs
Text Tools
Unicode Case Conversion Challenges: The Turkish I Problem, German ß, and Locale-Aware APIs
Title Case Isn't One Rule: How AP, Chicago, and MLA Disagree on Prepositions and Hyphens
Text Tools
Title Case Isn't One Rule: How AP, Chicago, and MLA Disagree on Prepositions and Hyphens
Why "JohnSmith" and "johnsmith" Are the Same Account Here But Different Accounts There: Case Sensitivity in Login Systems
Text Tools
Why "JohnSmith" and "johnsmith" Are the Same Account Here But Different Accounts There: Case Sensitivity in Login Systems
camelCase vs snake_case Isn't a Style Choice in APIs — It's a Contract, and Changing It Breaks Your Consumers
Text Tools
camelCase vs snake_case Isn't a Style Choice in APIs — It's a Contract, and Changing It Breaks Your Consumers