How is JSON different then a JavaScript (programming language) object?
17th January 2012
My answer to How is JSON different then a JavaScript (programming language) object? on Quora
JSON is a carefully selected subset of JavaScript. A JSON object can only consist of dictionaries, strings, numbers (in JavaScript floating point and integers are treated as the same thing), lists, booleans and null. The spec on JSON.org is a good guide: http://json.org/
In terms of formatting, JSON objects must have double quotes around strings (JavaScript allows single quotes) and must have double quotes around dictionary keys (optional in JavaScript for keys that only contain a-zA-Z0-9_).
JSON is also strict about not leaving trailing commas on dictionary and list declarations, whereas most JavaScript engines will let you get away with those.
More recent articles
- What's new in the world of LLMs, for NICAR 2025 - 8th March 2025
- I built an automaton called Squadron - 4th March 2025
- Notes from my Accessibility and Gen AI podcast appearance - 2nd March 2025