Small Tools
Code Utilities utility

JavaScript Object to JSON

Convert a JavaScript-style object literal into valid, formatted JSON.

● This tool runs entirely in your browser. Your input is never uploaded to our servers.
Output
Your result will appear here…

How to use JavaScript Object to JSON

  1. Paste an object literal using keys, strings, numbers, booleans, null, arrays, and nested objects.
  2. Select Convert to produce valid JSON.
  3. Review the result; functions and executable expressions are not supported.

Example

Input / settings:

{ name: 'Ada', active: true, skills: ['design', 'logic'], }

Output:

{
  "name": "Ada",
  "active": true,
  "skills": [
    "design",
    "logic"
  ]
}

When to use

Overview

Convert a JavaScript-style object literal into valid, formatted JSON.

Supported input

JavaScript object literal

Output details

formatted JSON

Privacy and security

This tool runs entirely in your browser. Your input is never uploaded to our servers.

Frequently asked questions

Can it evaluate JavaScript code?

No. It parses a limited literal syntax and never executes input code.

Are unquoted keys and trailing commas allowed?

Yes. Identifier keys and trailing commas are supported.

Which values are supported?

Strings, numbers, booleans, null, arrays, and nested objects are supported; functions and variables are not.

Related tools