Developer tool / 27

JS Object Literal to Strict JSON Converter

Convert unquoted JS object literals, single quotes, and trailing commas into strict JSON payloads.

JS Object Literal to Strict JSON Converter: TOEA parses unquoted keys, single-quoted string values, and trailing commas to output valid JSON. Runs 100% locally in your browser with zero server file uploads.

Runs
In your browser
Cost
Free · no sign-up
Availability
Ready to use

What changes on the way to JSON

Some JavaScript values have no JSON form. A property set to undefined disappears, and undefined inside an array becomes null. Hex numbers and numeric separators such as 1_000 are written as ordinary decimals. Template literals become plain strings, with any ${…} left as literal text. Integers beyond 9,007,199,254,740,991 lose precision, because the value passes through a JavaScript number; quote long IDs as strings in the source first.

Data only, never code

The converter reads the literal as data and never runs it, so a pasted snippet cannot do anything. The cost is that anything computed is refused: variables, function calls, new Date(), spread syntax, NaN, and Infinity. Replace each with the value you want in the JSON, then convert again; the error names the line and column to look at. A leading const name = or export default is removed automatically. The JSON validator confirms the result before it goes into a config file.

How to use it

  1. Paste a JS object snippet.
  2. Set formatting indentation.
  3. Copy the valid JSON output.

Privacy & limitations

Parsing and formatting take place 100% in your local browser environment.

Related tools

Frequently asked questions

Can it parse objects with single quotes?

Yes, single-quoted property keys and values are automatically converted to double quotes.

Free tool · runs in your browser · no account required