JS object to JSON

Turn a JavaScript object literal — unquoted keys, single quotes, trailing commas — into strict JSON.

Converted in this browser. Nothing is sent anywhere.

Accepts a JSON5-style subset: unquoted keys, single quotes, trailing commas, // and block comments, hex/binary/octal numbers. Functions, spreads, and computed keys are rejected (this is not eval). Up to 1,000,000 characters.

How to use

  1. Paste a JS object literal.
  2. Convert.
  3. Copy the JSON.

What it supports

Parses object/array literals with single or double quotes, template-free strings, trailing commas, comments, and number literals (hex, binary, octal, exponents, Infinity, NaN→null). Functions, variables, and spread syntax are not supported. Input up to 1 MB.

Related tools

Related guides