Structured Data

JSON to JavaScript

Paste JSON and get ready-to-use JavaScript — a const, a module export, or a plain object literal. Choose your quoting, indentation and key style, then copy or download the result. Everything runs in your browser.

Runs in your browser v1.0.0

Output format

updates live

Use letters, digits, dollar signs or underscores. It cannot start with a digit.

A named constant you can reuse — the usual way to drop JSON into a script.

Formatting options
Statement

JSON input

never uploaded

Parsed with the browser’s own JSON parser. Invalid input is reported with a line and column instead of a broken state.

JavaScript output

ready


                

How it works

Your input is parsed with JSON.parse() in this page and re-serialized as JavaScript literals — strings are escaped for the quote style you choose, object keys are quoted only when they are not valid identifiers, and the result is wrapped in the statement you pick. Numbers keep their parsed value, so extremely large integers may already have been rounded before conversion. Nothing is sent to a server; the optional share link keeps the state in the URL fragment, which never leaves your browser.