Single quotes vs double quotes: common JSON mistakes

TL;DR: Make the JSON strict, validate locally, then export/convert (no upload).

A frequent “it looks fine” bug: you copied a JavaScript object or a config snippet using single quotes. JSON.parse rejects it immediately.

Why JSON requires double quotes

JSON is a data format with a strict grammar. Keys and string values must use double quotes. Single quotes are not part of the JSON spec. Many tools show “JSON-like” objects with single quotes, which is convenient for humans but invalid for parsers.

Fast ways to identify the issue

  • Look for ' characters around keys or strings.
  • Check if keys are unquoted: {a: 1} is not valid JSON.
  • Watch for comments and trailing commas (often paired with single quotes).

Fix strategy

  1. Replace single quotes with double quotes (carefully).
  2. Ensure embedded quotes are escaped properly.
  3. Validate again to catch trailing commas or extra text.

Trust note: All processing happens locally in your browser. Files are never uploaded.

Practical checklist (fast)

If you’re stuck, use this quick checklist to narrow the problem before you try “random fixes”. Start by validating the input format (syntax first), then confirm shape expectations (array vs object, headers vs rows). Convert a small sample, inspect the output, and only then export the full result.

  • Validate: confirm the input is strict JSON/XML/CSV (no stray characters).
  • Confirm shape: arrays vs objects; headers vs row lengths; repeated tags vs arrays.
  • Test a sample: first 20–50 rows/items are enough to detect parsing issues.
  • Export: copy/download the output and re-check it in the consumer (script/spreadsheet/API).

This workflow is privacy-first by design: All processing happens locally in your browser. Files are never uploaded.

FAQ

Can I safely “search/replace” all quotes? Usually yes for simple payloads, but be careful if strings themselves contain quotes.

Why do some APIs show single quotes? They usually show JavaScript object literals or pseudo JSON in docs—not strict JSON.

Local verification snippet

Run a quick local check before export/convert:

const text = input.trim();
const value = JSON.parse(text);
console.log(Array.isArray(value) ? 'array' : typeof value);
Privacy & Security
All processing happens locally in your browser. Files are never uploaded.