How to use JSON to JS Object
- Paste your JSON.
- Copy the JavaScript object literal.
- Check any very large integers, which lose precision as JSON numbers.
- Keys that are not valid identifiers keep their quotes — that is correct, not a limitation.
- Integers beyond 2⁵³ lose precision; keep them as strings.
- Conversion runs in your browser; API data is not transmitted.
What actually differs between the two
JSON is a strict subset of JavaScript object syntax with the corners removed. JavaScript allows unquoted keys where they are valid identifiers, single quotes, trailing commas, comments, template literals, functions as values, undefined, NaN, Infinity and comment blocks. JSON allows none of those — double-quoted keys and strings, no trailing comma, no comments, null and nothing else. Converting JSON to JS is therefore always safe; converting JS to JSON is not.
Keys that cannot be unquoted
A key only loses its quotes if it is a valid JavaScript identifier: letters, digits, underscore and dollar, not starting with a digit. So content-type, user name and 2fa keep their quotes and are accessed with bracket notation. Reserved words are fine as property names in modern JavaScript, so class and default can be unquoted, though quoting them anyway reads more clearly.
Numbers are where a round trip loses data
JSON numbers become IEEE-754 doubles when parsed, so an integer beyond 2⁵³ loses precision — a 19-digit id like a Twitter snowflake or a database bigint comes back with its last digits changed, silently. If your data contains such values, keep them as strings or use BigInt literals in the JavaScript, which JSON cannot represent at all. This is the one conversion hazard worth checking for before pasting an API response into code.
Frequently asked questions
Why convert JSON to JavaScript?
Is the output valid JavaScript?
Is JSON valid JavaScript?
Why do some of my keys still have quotes?
Can I convert JavaScript back to JSON?
How do we know nothing is uploaded? Test it yourself on the privacy proof page.