JSON to JavaScript

Convert JSON into a JavaScript object literal, const variable, ES module default export, or CommonJS export. It is useful for application config, fixtures, demos, seed data, tests, and small scripts.

Choose a JavaScript output style

Valid JavaScript property names are written without quotes; keys containing spaces, punctuation, or leading numbers remain quoted. The variable name is cleaned so it can be used as a JavaScript identifier.

Conversion notes

The input must be strict JSON, so comments, trailing commas, functions, undefined, and JavaScript expressions are not accepted. The output represents the same data but does not add application logic or validation. Conversion happens locally in the browser.

Related tools: JSON to TypeScript · JSON Formatter