The cases, with examples
| Case | Example | Where you meet it |
|---|---|---|
| UPPERCASE | ORDER TOTAL AMOUNT | Headings, warnings, SQL keywords |
| lowercase | order total amount | Email addresses, host names, normalising input before comparing |
| Title Case | Order Total Amount | Headlines, page titles, button labels |
| Sentence case | Order total amount | Body text, interface copy |
| camelCase | orderTotalAmount | JavaScript and Java variables; JSON keys in many APIs |
| PascalCase | OrderTotalAmount | Class and type names; C# properties |
| snake_case | order_total_amount | Python and Ruby; database columns; JSON keys in many other APIs |
| CONSTANT_CASE | ORDER_TOTAL_AMOUNT | Constants and environment variables |
| kebab-case | order-total-amount | URL paths, CSS classes, command-line flags |
| Train-Case | Order-Total-Amount | HTTP header names such as Content-Type |
| dot.case | order.total.amount | Configuration keys, event names such as invoice.paid |
The last row is why webhook event types look the way they do, and the one above it is why HTTP headers do. Header names are in fact case-insensitive, and HTTP/2 sends them all in lower case; Train-Case is a convention for people, covered in the HTTP headers guide.
Renaming JSON keys between conventions
The commonest reason a developer needs this tool is a mismatch at an API boundary. The back end is
Python or Ruby and speaks snake_case; the front end is JavaScript and wants
camelCase; a third-party API uses whichever you are not. Set Apply to to
JSON keys, paste a response body, and choose the target case:
{ "user_id": 4021, "billing_address": { "postal_code": "EC1A 1BB" } }
→ camelCase
{ "userId": 4021, "billingAddress": { "postalCode": "EC1A 1BB" } }
Keys are renamed at every level, inside nested objects and arrays. Values are never touched, so a string that happens to contain underscores stays exactly as it was. That is the difference from running a find-and-replace over the text, which cannot tell a key from a value.
Two things to watch for
Collisions. Two keys that differ only in style, such as user_id and
userId in the same object, become the same key after conversion and one value overwrites
the other. The tool counts keys before and after and warns when any were lost.
The round trip is not always exact. userID becomes user_id
in snake_case, and converting that back gives userId, not the original. Acronyms and
digits are where conventions disagree, so decide on one spelling and apply it everywhere. For a quick
check of what changed, paste both versions into JSON compare.
This is useful for building a test fixture or reading an unfamiliar response. In an application, do the conversion in one place — a serializer setting or a small function at the edge of your HTTP client — and not by hand. The JSON formatter and JSON viewer help with the same payloads.
How words are found
Converting to a code case means first deciding where one word ends and the next begins. The tool splits on anything that is not a letter or a digit, and also inside existing identifiers:
| Input | Words found | snake_case |
|---|---|---|
order total amount | order, total, amount | order_total_amount |
orderTotalAmount | order, Total, Amount | order_total_amount |
Order-Total-Amount | Order, Total, Amount | order_total_amount |
HTTPServerError | HTTP, Server, Error | http_server_error |
userID | user, ID | user_id |
version2Beta | version2, Beta | version2_beta |
A run of capitals followed by a capitalised word is treated as an acronym and kept together, which is
how HTTPServerError comes out right. A digit stays attached to the word before it.
Apostrophes are dropped, so don't stop becomes dontStop. Letters outside the
English alphabet are handled as letters, not as separators.
Lists
Paste one name per line and choose a code case, and each line is converted on its own, giving you a column of converted names in the same order. That is the fast way to turn a list of database columns into property names, or spreadsheet headings into keys. Force the behaviour either way with the Apply to selector.
Title case and sentence case have judgement in them
Title Case here capitalises every word except short articles, conjunctions and
prepositions — a, an, the, and, but, or, for, nor, as, at, by, in, of, on, per, to, up, via, vs — unless
one of them comes first or last. Words that already contain a deliberate capital, such as
iPhone, API or McDonald, are left as you typed them. Style guides
differ on the details, particularly on longer prepositions, so treat the result as a first pass for a
headline, not as the final word.
Sentence case lowers everything and then capitalises the first letter after a full
stop, question mark, exclamation mark or line break, and the pronoun “I”. It cannot know which words
are names, so london and ada will need putting back by hand.
Upper and lower case follow Unicode rules, which occasionally surprise: the German ß
becomes SS in upper case and does not come back. If you are lower-casing identifiers to
compare them, such as email addresses, that is the behaviour you want; if you are trying to preserve
text exactly, it is not.
Frequently asked questions
How do I convert text to camelCase?
Paste the text or an existing identifier above and press camelCase. The words are joined with no separator, the first in lower case and each later one capitalised, so “order total amount” and “order_total_amount” both become orderTotalAmount.
What is the difference between camelCase and PascalCase?
Only the first letter. camelCase starts with a lower-case letter, as in orderTotal, and PascalCase starts with a capital, as in OrderTotal. PascalCase is sometimes called upper camel case.
What is the difference between snake_case and kebab-case?
The separator. snake_case joins lower-case words with underscores and is valid as a variable name in most languages. kebab-case joins them with hyphens, which most languages read as a minus sign, so it is used in URLs, CSS class names and command-line flags instead.
How do I convert JSON keys from snake_case to camelCase?
Set Apply to to JSON keys, paste the JSON, and press camelCase. Every key at every depth is renamed and the values are left unchanged. The same works in the other direction and for any of the code cases.
Which case should JSON keys use?
There is no rule in the JSON specification. camelCase is common in APIs written for JavaScript clients and snake_case in APIs from Python and Ruby back ends. What matters is using one convention consistently across an API.
Which words stay lower case in title case?
Short articles, conjunctions and prepositions such as a, an, the, and, but, or, of, in, on, to and for, unless they are the first or last word. Style guides disagree on the exact list, so check the result against the guide you follow.
Is my text uploaded?
No. The conversion runs in JavaScript on this page and no network request is made with your text.
Related tools and reference
JSON Formatter
Pretty-print the JSON before or after renaming its keys.
JSON Compare
Confirm that only the keys changed.
JSON Viewer
Browse a large response as a tree.
SQL Formatter
Upper-case SQL keywords and lay a query out clause by clause.
HTTP Headers
Why header names are written in Train-Case, and why it does not matter.
URL Encoder
Prepare a kebab-case slug or a query value for a URL.