JSON to JavaScript Converter
Turn JSON into a formatted JavaScript object literal.
JSON
JavaScript
About the JSON to JavaScript converter
JSON requires every key to be quoted. JavaScript does not, and the unquoted version is considerably easier to read in a source file.
This converter produces an exported const holding your data as a formatted object literal — the shape you want for a test fixture, a seed file or a static config module.
What changes
Keys that are valid JavaScript identifiers lose their quotes. Keys with dashes, spaces or leading digits keep them, because they have to.
Values are unchanged — strings stay double-quoted and escaped exactly as JSON.stringify would write them.
Frequently asked questions
Is the output valid TypeScript too?
Yes. If you also want an explicit type for it, run the same JSON through the JSON to TypeScript converter.
Can I get a plain object without the export?
Delete the `export const data = ` prefix — everything after it is a standalone literal.