Skip to main content
CuteJSON
↑↓ Navigate Enter Select Esc Close

JSON to JavaScript Converter

Convert between JSON and a JavaScript object literal without either document leaving your browser.

Back to all tools

Keyboard shortcuts

These work wherever the matching action exists on this page.

Open the command palette
Ctrl/Cmd + K
Run the main action
Ctrl/Cmd + Enter
Format
Ctrl/Cmd + Shift + F
Minify
Ctrl/Cmd + Shift + M
Copy output
Ctrl/Cmd + Shift + C
Open file
Ctrl/Cmd + Shift + O
Download output
Ctrl/Cmd + S
Close this dialog
Esc
Open this dialog
F1 / ?

Local data

Everything below is stored only in this browser, on this device. None of it is ever sent anywhere, and closing this dialog is not required for that to stay true.

Unsaved drafts
Tools with remembered options

Recently opened files

    No files opened yet on this device.

    Share via link

    The content is packed into the part of the link after the # sign, which browsers never send to a server. Nothing here is uploaded to cutejson.com or anywhere else.

    Shares the first input on this page. On a tool with more than one, only that one is included.

    Nothing to share yet. Paste or type something first.

    JSON

    Load from a URL

    Fetches the URL directly from your browser and loads whatever text it returns into this pane.

    JavaScript

    The result appears here.

    Runs entirely in your browser. Nothing you paste is uploaded, and you can confirm that in your browser Network tab.

    About this tool

    JavaScript and JSON are close enough that any JSON document is already a valid JavaScript expression, but JavaScript adds conveniences JSON forbids. Writing, a key that is a valid identifier is written bare, an empty object or array stays on one line, and numbers travel through the token stream, so a twenty digit integer comes back with all twenty digits. Reading, an object literal with unquoted keys, single quoted strings, comments, trailing commas, template literals without interpolation and a leading const, let or var name are all accepted, and a number spelling JSON rejects, such as .5, 5. or 5.e3, is normalized to its exact JSON form. Everything JSON cannot hold is refused by name rather than guessed at: undefined, NaN and Infinity, hex, octal or binary numbers, numeric separators, a leading zero, a regular expression, a function and template interpolation. A key that appears twice is refused, and a __proto__ key whose value is an object or null is refused too, because in a JavaScript object literal that spelling sets the prototype instead of creating a property. An undefined can become null when you opt in, since JSON has no undefined and silently replacing a value can change what the data meant.

    How to use

    1. Choose a direction, then paste your document into the left pane or load the sample.
    2. Pick the indent width, then press Convert.
    3. Copy the result or download it as a file.

    Keep reading

    How to convert JSON to JavaScript object literals and back Read the guide