Core answer: per RFC 4180, a CSV field containing a comma, double quote or newline must be wrapped in double quotes (inner quotes doubled); the universal naming-case algorithm is "split into words, then rebuild"; a URL slug is lowercase words joined by hyphens with accents removed via NFKD.

CSV↔JSON conversion rules

Three core RFC 4180 rules: ① a field with a comma gets wrapped in quotes — "Boston, MA"; ② a field with a double quote doubles it — "He said ""hi"""; ③ a field with a newline keeps it inside quotes.

Raw CSVJSON result
name,age + Ada,28[{"name":"Ada","age":"28"}]
"Boston, MA"One field: Boston, MA
"He said ""hi"""One field: He said "hi"

Every CSV value is a string by default — 28 arrives as "28"; parse it yourself if you need a number.

Nine naming styles compared

Using "user login count":

StyleOutputTypical use
camelCaseuserLoginCountJS/Java variables
PascalCaseUserLoginCountClasses, components
snake_caseuser_login_countPython, DB columns
SCREAMING_SNAKEUSER_LOGIN_COUNTConstants, env vars
kebab-caseuser-login-countURLs, CSS classes
dot.caseuser.login.countConfig keys
flatcaseuserlogincountGo package-private
Title CaseUser Login CountHeadlines
Train-CaseUser-Login-CountHTTP headers

The algorithm: split into a word array first (camelCase on case boundaries, snake/kebab on separators), then rebuild with the target rules.

URL slug best practices

  1. All lowercase/Best-Practices and /best-practices can be two different URLs
  2. Hyphens between words — Google treats - as a separator, _ glues words
  3. Strip accents — café → cafe (NFKD normalization drops combining marks)
  4. Drop stop words — shorter slugs win

Non-English titles can stay native (modern stacks support it) or be transliterated. The [slug generator](/c/dev/slugify) offers a keep-CJK mode.

Example: CSV with commas and newlines

```

name,address,note

"Li Si","Chaoyang, Beijing","line one

line two"

```

becomes [{"name":"Li Si","address":"Chaoyang, Beijing","note":"line one\nline two"}] — the comma and newline survive inside quoted fields. The [CSV↔JSON converter](/c/dev/csv-json) also warns on inconsistent column counts.

Example: slug from an article title

"Frontend Trends 2024: React, Vue & Svelte!" → lowercase → strip punctuation → drop stop words → hyphens: frontend-trends-2024-react-vue-svelte. Apostrophes are removed, not hyphenated ("what’s" → "whats").

Common mistakes

  • Parsing CSV with split(","): it shatters on the first embedded comma. Use a state machine or a real parser.
  • Single quotes or trailing commas in JSON: JSON is double-quote only, no trailing commas, no comments — pasting from a JS object always breaks.
  • Keyword-stuffed slugs: best-cheap-top-2024-review reads as spam; 3-5 real words is ideal.
  • Splitting acronym runs wrong: XMLHttpRequest should become xml_http_request, not x_m_l_http_request — treat consecutive capitals as one word.