Case Conversion for API Data Cleanup, Normalizing Messy Exports
API exports mix PRODUCT_NAME, productName, and "Active" with "ACTIVE." Lowercase the keys you match on, keep display names and passwords as they are, trim spaces before you convert, and map the exceptions. Case conversion does not fix JSON syntax.
By Rehan Baqir
Case conversion changes letters so matching keys and enums collapse to one form. It does not rewrite schema, insert underscores, or fix JSON syntax, and it will damage a display name or a password if you run it on the wrong field. Use the Case Converter for a one-off paste. Script the rule once you know which fields are canonical and which must stay as the user typed them. Lowercase keys you join on. Preserve brand and display casing. Trim whitespace before you convert.
A webhook looked fine until someone grouped by status and got twelve buckets for what should have been three. ACTIVE, active, Active, and active with a trailing space all counted as different values. The bug was casing. Case conversion fixes that in minutes if you apply it to the right fields.
API integrations inherit old naming. A CRM export arrives in UPPERCASE. A legacy system sends Customer_Name. A mobile client sends productId while the warehouse expects product_id. Case conversion will not solve every schema mismatch. It is the fastest first pass, before regex, mapping tables, and migration scripts.
Canonical keys and display labels
Production systems should separate two layers.
Canonical keys use lowercase, or one documented convention, for storage, joins, and API matching.
Display labels use whatever case the user or the brand requires.
Converting NEW YORK to new york for a grouping key is useful. Converting McSorley's to mcsorley's on a shipping label is not.
The Case Converter does the mechanical change. You decide which fields get which treatment.
Common messes
| Source | Example field | Problem |
| --- | --- | --- |
| Legacy SQL export | PRODUCT_NAME | All-caps constants |
| .NET API | ProductName | PascalCase properties |
| JavaScript client | productName | camelCase |
| Python service | product_name | snake_case |
| CSV header row | Product Name | Spaces and title case |
| Enum values | PENDING, Pending | Duplicate logical states |
Case conversion is step one. A structural rename, such as spaces to underscores, is step two.
Cleaning a JSON export
A partner sends nightly JSON with inconsistent enum casing.
- Validate the JSON. The JSON Validator catches syntax errors before you touch values.
- Identify the enum fields:
status,type,country_code. - Extract the unique values into a text file.
- Lowercase them for an inventory. The Case Converter shows the real distinct count.
- Build a mapping table:
PENDINGtopending,Activetoactive. - Apply the map in ETL. Do not paste production volume by hand.
- Spot-check the output with the JSON Formatter.
Lowercasing showed that active and active differ. Trim whitespace before you normalize case.
Field names and field values
Standardize keys to one convention:
ProductName → productName (camelCase API)
PRODUCT_NAME → product_name (snake_case warehouse)
Case conversion handles letter case. Inserting underscores between words needs a regex or a camelCase splitter:
productName → product_name (not just lowercase → productname)
Values depend on the domain:
| Value type | Normalize? |
| --- | --- |
| Enum or status | Yes, to a lowercase canonical value |
| Email | Often lowercase the whole address |
| Country code | Uppercase ISO, such as US |
| Password hash | Never change case |
| Display name | Preserve what the user typed |
| SKU or product code | Case-sensitive. Do not convert |
Email and usernames
Many systems lowercase an email before storage so the same person cannot open two accounts:
User@Example.COM → user@example.com
Write that policy down. Passwords stay case-sensitive. Never run case conversion on a credential. See the password security guide.
Spreadsheets and CSV imports
A CRM City column arrives like this:
NEW YORK
new york
New York
For a pivot table or a VLOOKUP:
- Paste the column into the Case Converter.
- Lowercase the whole column.
- Re-import it as
city_normalized. - Keep the original column for display if you need it.
Pair that with the Word Counter when a title field has a length limit.
Prevent the mess in the API
If you control the API:
- Document the casing in the OpenAPI spec
- Reject an unknown enum casing with a 400 and a clear error
- Emit lowercase enums in JSON responses
- Lint the schema definitions
If you consume a third-party API:
- Normalize on ingest, not on every read
- During a migration, store both
raw_statusandstatus_normalized - Log an unmapped value. Do not drop it silently
Locale traps
Turkish dotted and dotless I breaks naive lowercasing:
Istanbul.toLowerCase() → istanbul (wrong in Turkish locale)
İstanbul → requires toLocaleLowerCase('tr')
German ß uppercases to SS, and the round trip is imperfect.
For English-only SKU cleanup, a simple converter is enough. For international customer names, use a locale-aware API in production code. The browser Case Converter is a preview. It is not internationalization infrastructure.
Keys change the object shape
{ "ProductName": "Widget" }
After key lowercasing, without a structural rename:
{ "productname": "Widget" }
That is not:
{ "product_name": "Widget" }
Automate key renames with jq, a Python dict comprehension, or a migration script. Use case conversion on values pasted as plain text. Use code for key transforms.
Read JSON vs JSONL when the export is line-delimited. Normalize each line in a streaming ETL job.
Underscores after the case change
From screaming snake case toward camel case:
- Lowercase:
STATUS_CODEbecomesstatus_code, if that is the target. - Or split on
_, capitalize the later segments, and producestatusCode.
The Case Converter will not insert underscores. Chain a search-and-replace, or do it in code.
Test the normalization
| Input | Expected canonical |
| --- | --- |
| ACTIVE | active |
| Active | active |
| active | active after trim |
| McDonald | mcdonald, or preserve it. Document the choice |
Assert the table in unit tests. One shared test UUID or constant across tests hides integration bugs. The same discipline shows up in how UUIDs work for IDs.
When case conversion is not enough
- Synonyms:
USA,US, andUnited Statesneed a lookup table - Typos:
actvewill not matchactiveafter lowercasing - Encoding: mojibake from the wrong character set has to be fixed before any text transform
- Spelling variants:
cancelledandcanceled
Normalize case first. Fuzzy-match second. A person reviews third.
Related articles
- Case converter guide: writing and SEO workflows
- JSON formatting guide: structural fixes, and how to inspect a cleaned payload
Limitations
Changing case does not repair trailing commas, quotes, or other JSON syntax errors. It does not insert underscores, translate synonyms, or apply Turkish or German case rules unless the code is locale-aware. A browser tool previews a paste. It is not a nightly ETL job. Edge cases and platform limits vary. Test on a sample payload first, and keep the original export archived.
Separate canonical keys from display values, then convert case only where enums and match fields need one form. Lowercase for grouping. Preserve case for brands and passwords. Trim before you convert. Follow with a mapping table for the exceptions. The Case Converter speeds up the first pass. The production pipeline should script the rules you find in that pass.
Frequently Asked Questions
Common questions answered to help you get the most from this tool.