Everything runs on your machine — your file is processed right here in your browser and never uploaded to any server.
Input
JSON
Loading...
Output
JavaScript object
Loading...

About this tool

JSON and JavaScript object literals look similar but follow different rules: JSON demands double-quoted keys and forbids comments and trailing commas, while idiomatic JavaScript prefers bare identifiers for keys. This tool rewrites JSON as a clean object literal, ready to paste into a .js or .ts source file without tripping your linter.

Front-end developers use it to turn API responses into mock data for tests and Storybook stories, and to convert downloaded fixtures into constants modules. Rather than hand-editing hundreds of quoted keys, you paste once and get a literal that reads like it was written in the codebase.

How to use

  1. Paste your JSON into the editor on the left, or open a .json fixture from disk using Load File.
  2. The JavaScript object literal is produced in the right editor instantly, staying in sync as you edit.
  3. Skim the output to confirm keys were unquoted where possible and the structure is untouched.
  4. Select Copy to paste the literal into your code, or Download to store it as a JavaScript file.

This page performs the rewrite with nothing but local browser JavaScript — fitting, given what it produces. Fixtures and API data you convert are never sent anywhere, logged, or retained after you close the tab.

Frequently asked questions

What actually changes between JSON and an object literal?

Keys that are valid JavaScript identifiers lose their surrounding quotes, and the whole document is reformatted as an expression you can assign to a variable. The values and structure remain exactly the same.

Is JSON not already valid JavaScript?

A JSON document is essentially a valid JavaScript expression, so pasting it raw usually works. The converted literal, however, matches common lint rules and code style, making it far more pleasant to keep in a source file long term.

What about keys containing spaces or dashes?

Keys that are not valid identifiers, such as ones with spaces, dashes, or leading digits, keep their quotes. That preserves correctness while everything else is cleaned up.