JavaScript → JSON
Accepts a single object, array, or scalar literal: strings, finite numbers, booleans, null, nested objects and arrays. Comments and a trailing semicolon are okay.
Convert strict JSON to a JavaScript data literal—or convert a plain JavaScript object or array literal back to JSON. The source is parsed locally and never executed.
A safe bridge between strict JSON and simple JavaScript data literals.
Accepts a single object, array, or scalar literal: strings, finite numbers, booleans, null, nested objects and arrays. Comments and a trailing semicolon are okay.
Converts strict JSON, preserves the original digits of numeric tokens, and can quote all keys. The special __proto__ key is emitted as a computed own property.
No eval, function calls, variables, getters, methods, spreads, sparse arrays, BigInt, non-finite numbers or computed expressions are executed or converted.
JavaScript input is parsed by the self-hosted Acorn parser in a web worker. The tool inspects the resulting syntax tree and rebuilds JSON data; it never runs your source. Duplicate keys and values that cannot be represented in JSON are rejected rather than silently changed.
When converting JSON to JavaScript, numeric text is retained. A warning appears for integers outside JavaScript’s safe integer range because those may be rounded when the resulting literal is evaluated by a JavaScript runtime.
Input and formatted output are limited to 1 MiB and 8 MiB respectively, with nesting and value-count guards. Large outputs are previewed in the editor; Copy and Download include the full result.
Use quoted strings for large identifiers, timestamps and account numbers. A number can be syntactically valid JSON yet still lose precision when used as a JavaScript Number.
No. It parses source into a syntax tree and accepts only plain data values. It never calls eval or executes the input.
They are executable behavior, not JSON data. The converter accepts simple key:value entries and JSON-compatible values only, so it can convert without invoking code.
No. Those values do not have direct JSON equivalents. Convert them intentionally—for example, use a quoted string for an identifier—before converting.
No. The parser and converter run locally in a browser worker. The tool does not upload or save the source.