SlideShare a Scribd company logo
The  JSON  Saga Douglas Crockford Yahoo! Inc.
I am a heretic. You have been warned.
I Discovered JSON I do not claim to have invented JSON.  It already existed in nature.  I do not claim to have been the first to discover it.  I gave it a specification and a little website. The rest happened by itself.
2001
State Software 2002
The Very First JSON Message April 2001 <html><head><script> document.domain = 'fudco.com'; parent.session.receive( {to:&quot;session&quot;, do:&quot;test&quot;,    text:&quot;Hello world&quot;} ); </script></head></html>
The Very First JSON Message April 2001 <html><head><script> document.domain = 'fudco.com'; parent.session.receive( {to:&quot;session&quot;, do:&quot;test&quot;,    text:&quot;Hello world&quot;} ); </script></head></html>
The Very First JSON Message April 2001 <html><head><script> document.domain = 'fudco.com'; parent.session.receive( {to:&quot;session&quot;, do:&quot;test&quot;,    text:&quot;Hello world&quot;} ); </script></head></html>
The Very First JSON Message April 2001 <html><head><script> document.domain = 'fudco.com'; parent.session.receive( {to:&quot;session&quot;, do:&quot;test&quot;,    text:&quot;Hello world&quot;} ); </script></head></html>
The Very First JSON Message April 2001 <html><head><script> document.domain = 'fudco.com'; parent.session.receive( {to:&quot;session&quot;, do:&quot;test&quot;,    text:&quot;Hello world&quot;} ); </script></head></html>
The Very First JSON Message April 2001 <html><head><script> document.domain = 'fudco.com'; parent.session.receive( {to:&quot;session&quot;,  do :&quot;test&quot;,    text:&quot;Hello world&quot;} ); </script></head></html>
The unquoted name problem ES3 has a wack reserved word policy. Reserved words must be quoted. I did not want to put the list of reserved words in the JSON spec, so... All keys must be quoted. It significantly simplified JSON. This conforms to Python.
Nested HTML <html><head><script> document.domain = 'fudco.com'; parent.session.receive( {&quot; to &quot;:&quot;session&quot;, &quot; do &quot;:&quot;test&quot;,    &quot; text &quot;:&quot; </script> &quot;} ); </script></head></html>
Nested HTML <html><head><script> document.domain = 'fudco.com'; parent.session.receive( {&quot; to &quot;:&quot;session&quot;, &quot; do &quot;:&quot;test&quot;,    &quot; text &quot;:&quot;< \ /script>&quot;} ); </script></head></html>
JSML JavaScript Message Language
JSON JavaScript Object Notation
JSON was really useful Browser/server communication. Interserver communication. JSON database.
Our customers said “Never heard of it.” “Sorry, our company just committed to XML.” “It is not a standard.”
I bought JSON.org A one-page web site that described JSON. Grammar three ways Simplified BNF Railroad diagrams Informal English A Java reference implementation. And then I retired.
And that’s all I did. A message format in a bottle.
Contributors
Languages ActionScript C C++ C# ColdFusion D Delphi E Eiffel Erlang Fan Flex Haskell haXe Java JavaScript Lasso Lisp LotusScript Lua Objective C Objective CAML OpenLaszlo Perl PHP Pike pl/sql PowerShell Prolog Python R REALbasic Rebol Ruby Scheme Squeak Tcl Visual Basic Visual FoxPro
JSON is the intersection of modern programming languages Simple values number string boolean Sequence of values array, vector, list Collection of named values object, record, struct, hash, property list
Recursive descent value = function () { // Parse a JSON value. It could be an object, an array, // a string, a number, or a word. white(); switch (ch) { case '{': return object(); case '[': return array(); case '&quot;': return string(); case '-': return number(); default: return ch >= '0' && ch <= '9' ? number() : word(); } };
State Machine state = 'go'; stack = []; try { for (;;) { r = tx.exec(source); if (!r) { break; } if (r[1]) { action[r[1]][state](); } else if (r[2]) { value = +r[2]; number[state](); } else { value = debackslashify(r[3]); string[state](); } source = source.slice(r[0].length); } }
Eval if ( /^[\],:{}\s]*$/ .test(text.replace( /\\(?:[&quot;\\\/bfnrt]|u[0-9a-fA-F]{4})/g , '@').replace( /&quot;[^&quot;\\\n\r]*&quot;|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g , ']'). replace( /(?:^|:|,)(?:\s*\[)+/g , ''))) { // In the third stage we use the eval function to compile the  // text into a JavaScript structure. The '{' operator is subject  // to a syntactic ambiguity in JavaScript: it can begin a block  // or an object literal. We wrap the text in parens to eliminate  // the ambiguity. j =  eval ('(' + text + ')');
JSON.parse Part of ECMAScript, Fifth Edition Available now in better browsers everywhere. Very fast. Very reliable.
Languages Arabic  Bulgarian  Chinese  Czech  Dutch  French  German  Greek  Hebrew  Hungarian  Indonesian Italian  Japanese  Korean  Persian  Polish  Portuguese  Russian  Slovenian  Spanish  Turkish  Vietnamese
Ajax! 2005
Improvements Removed comments. Dangerous practices Unnecessary complexity Alignment with YAML Added  e  notation to numbers.
No version number. JSON will not be changed. Stability is more important than any feature we can think of. Perhaps someday it will be replaced.
Minimalism It can fit on the back of a business card.
Influences
Lisp S-expressions 1958
Rebol
JavaScript Python NewtonScript
NeXT OpenStep Property Lists 1993
XML The High Priced Spread
HTML Always bet on angle brackets.
Ask not if it is good enough. Ask if it can be popular enough.
Maybe only something  this simple could work. John Seely Brown, April 2002
Maybe only something this complicated could work. 2002
XMLsucks.org Why XML is technologically terrible, but you have to use it anyway
XML is the standard so shut up. SHUT UP!
XML Alternatives JSON config YAML CanonML HDF SSYN OGDL SDL DL Boulder ONX SMEL Property lists ConfigObj GroovyMarkup ATerms LNML GODDAG JITTs Esis/Pyxie ConciseXML SML TexMecs A specification language Waterken doc UBF Xqueeze Ool atx Grutatxt APT txt2docbook txt2tags AsciiDoc reStructuredText Epytext EtText AFT txt2html Setext Latte Confluence Markdown SmartyPants Textile Atox CDuce MarkupMatrix WikiMl IWML SEXP sfsexp Lambda markup language SXML Better markup tXML SOX SLiP ezex Tanga (NBML) XSLScript & TerseXML Lx NiceXSL PXSL ShoXS XSCS SML MIN MINML ESPX PXML GMarkup ASN BLOB SDXF CTX ASDL WDDX REBOL http://www.pault.com/pault/pxml/xmlalternatives.html
Disruption Threats
It’s not even XML! Who did this travesty?  Let’s find a tree and string them up. Now.  Dave Winer, 2006-12-20
any damn fool could produce a better data format than XML James Clark, 2007-04-06
Use the right tool  for the right job. When your only tool is a wrench, every problem looks like a nail.
Where did the idea come from that data should be represented by a document format?
RUNOFF .SK 1 Text processing and word processing systems typically require additional information to be interspersed among the natural text of the document being processed.  This added information, called &quot;markup&quot;, serves two purposes: .TB 4 .OF 4 .SK 1 1.#Separating the logical elements of the document; and .OF 4 .SK 1 2.#Specifying the processing functions to be performed on those elements. .OF 0 .SK 1
GML :h1.Chapter 1:  Introduction :p.GML supported hierarchical containers, such as :ol :li.Ordered lists (like this one), :li.Unordered lists, and :li.Definition lists :eol. as well as simple structures. :p.Markup minimization (later generalized and  formalized in SGML), allowed the end-tags to be omitted for the &quot;h1&quot;  and &quot;p&quot; elements.
:eol. ::ol. </ol>
Brian Reid’s Scribe @Quote(Any damn fool) ( )  [ ]  { }  < >  &quot; &quot;  ' ' @Begin(Quote) Any damn fool @End(Quote) 1980
Scribe @techreport(PUB, key=&quot;Tesler&quot;, author=&quot;Tesler, Larry&quot;,  title=&quot;PUB: The Document Compiler&quot;,  year=1972, number=&quot;ON-72&quot;, month=&quot;Sep&quot;,  institution=&quot;Stanford University Artificial Intelligence Project&quot;) @book(Volume3, key=&quot;Knuth&quot;,  author=&quot;Knuth, Donald E.&quot;,  title=&quot;Sorting and Searching&quot;, publisher=&quot;Addison-Wesley&quot;, year=1973, volume=3, series=&quot;The Art of Computer Programming&quot;,  address=&quot;Reading, Mass.&quot;)
License The Software shall be used  for Good, not Evil.
I give permission to IBM,  its customers, partners, and minions, to use JSLint for evil.  Thanks very much, Douglas!  Staff Attorney, IP Law IBM Corporation
The JSON Logo
The Impossible Torus
Ambihelical Hexnut
 
 
 
 
www.JSON.org

More Related Content

PPT
Jsonsaga
PPT
Douglas Crockford Presentation Jsonsaga
PPT
TAUS USER CONFERENCE 2009, Normalization of translation memories
ODP
Using DAOs without implementing them
PPTX
Php extensions
PPTX
Aall denver 2010
PDF
RDF Tutorial - SPARQL 20091031
PPTX
Remodelling of a Database of Bavarian Dialects into TEI XML and LOD
Jsonsaga
Douglas Crockford Presentation Jsonsaga
TAUS USER CONFERENCE 2009, Normalization of translation memories
Using DAOs without implementing them
Php extensions
Aall denver 2010
RDF Tutorial - SPARQL 20091031
Remodelling of a Database of Bavarian Dialects into TEI XML and LOD

Viewers also liked (16)

PPT
Ajax Performance
PPT
The Theory Of The Dom
KEY
Douglas Crockford - Programming Style and Your Brain
PDF
Performance, Games, and Distributed Testing in JavaScript
PDF
Performance Improvements in Browsers
PPT
Douglas Crockford - Ajax Security
PDF
Building a JavaScript Library
PPT
PPT
OOP in JavaScript
PDF
Good Parts of JavaScript Douglas Crockford
PPT
Advanced Javascript
PPTX
Advanced JavaScript Concepts
PDF
Scalable JavaScript Application Architecture
PDF
The DOM is a Mess @ Yahoo
PDF
The JavaScript Programming Language
PDF
Speed Up Your JavaScript
Ajax Performance
The Theory Of The Dom
Douglas Crockford - Programming Style and Your Brain
Performance, Games, and Distributed Testing in JavaScript
Performance Improvements in Browsers
Douglas Crockford - Ajax Security
Building a JavaScript Library
OOP in JavaScript
Good Parts of JavaScript Douglas Crockford
Advanced Javascript
Advanced JavaScript Concepts
Scalable JavaScript Application Architecture
The DOM is a Mess @ Yahoo
The JavaScript Programming Language
Speed Up Your JavaScript
Ad

Similar to The JSON Saga (20)

PPT
XML and Web Services with PHP5 and PEAR
PPT
Php Simple Xml
PPT
Everything You Always Wanted To Know About XML But Were Afraid To Ask
PPT
Embedded Metadata working group
PPT
XML processing with perl
PPT
PPT
PPT
Javascript2839
PDF
Jsonsaga 100605143125-phpapp02
PDF
OSCON 2004: XML and Apache
ODP
About Tokens and Lexemes
PPT
Processing XML with Java
PPT
3 xml namespaces and xml schema
PPT
Digital + Container List
PPT
PPT
JWU Guest Talk: JavaScript and AJAX
PPT
Pmm05 16
PDF
Xml Demystified
PPT
Inroduction to XSLT with PHP4
PPT
Sax Dom Tutorial
XML and Web Services with PHP5 and PEAR
Php Simple Xml
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Embedded Metadata working group
XML processing with perl
Javascript2839
Jsonsaga 100605143125-phpapp02
OSCON 2004: XML and Apache
About Tokens and Lexemes
Processing XML with Java
3 xml namespaces and xml schema
Digital + Container List
JWU Guest Talk: JavaScript and AJAX
Pmm05 16
Xml Demystified
Inroduction to XSLT with PHP4
Sax Dom Tutorial
Ad

More from kaven yan (10)

PDF
我的工作态度+@口碑网
PDF
我的工作态度@口碑网
PDF
工作指南@口碑网
PDF
From YUI3 to K2
PDF
HTML5@电子商务.com
PDF
Http协议(rfc2616)中文版
PDF
互联网精神
PDF
理解Ajax性能
PDF
拆分初始化负载
PDF
前端性能优化和自动化
我的工作态度+@口碑网
我的工作态度@口碑网
工作指南@口碑网
From YUI3 to K2
HTML5@电子商务.com
Http协议(rfc2616)中文版
互联网精神
理解Ajax性能
拆分初始化负载
前端性能优化和自动化

Recently uploaded (20)

PDF
Spectral efficient network and resource selection model in 5G networks
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PPTX
MYSQL Presentation for SQL database connectivity
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Spectroscopy.pptx food analysis technology
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Empathic Computing: Creating Shared Understanding
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Tartificialntelligence_presentation.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Getting Started with Data Integration: FME Form 101
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PPTX
Machine Learning_overview_presentation.pptx
Spectral efficient network and resource selection model in 5G networks
NewMind AI Weekly Chronicles - August'25-Week II
MYSQL Presentation for SQL database connectivity
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Spectroscopy.pptx food analysis technology
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Empathic Computing: Creating Shared Understanding
Building Integrated photovoltaic BIPV_UPV.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Machine learning based COVID-19 study performance prediction
Tartificialntelligence_presentation.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Group 1 Presentation -Planning and Decision Making .pptx
Network Security Unit 5.pdf for BCA BBA.
Getting Started with Data Integration: FME Form 101
Dropbox Q2 2025 Financial Results & Investor Presentation
A comparative analysis of optical character recognition models for extracting...
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Machine Learning_overview_presentation.pptx

The JSON Saga

  • 1. The JSON Saga Douglas Crockford Yahoo! Inc.
  • 2. I am a heretic. You have been warned.
  • 3. I Discovered JSON I do not claim to have invented JSON. It already existed in nature. I do not claim to have been the first to discover it. I gave it a specification and a little website. The rest happened by itself.
  • 6. The Very First JSON Message April 2001 <html><head><script> document.domain = 'fudco.com'; parent.session.receive( {to:&quot;session&quot;, do:&quot;test&quot;, text:&quot;Hello world&quot;} ); </script></head></html>
  • 7. The Very First JSON Message April 2001 <html><head><script> document.domain = 'fudco.com'; parent.session.receive( {to:&quot;session&quot;, do:&quot;test&quot;, text:&quot;Hello world&quot;} ); </script></head></html>
  • 8. The Very First JSON Message April 2001 <html><head><script> document.domain = 'fudco.com'; parent.session.receive( {to:&quot;session&quot;, do:&quot;test&quot;, text:&quot;Hello world&quot;} ); </script></head></html>
  • 9. The Very First JSON Message April 2001 <html><head><script> document.domain = 'fudco.com'; parent.session.receive( {to:&quot;session&quot;, do:&quot;test&quot;, text:&quot;Hello world&quot;} ); </script></head></html>
  • 10. The Very First JSON Message April 2001 <html><head><script> document.domain = 'fudco.com'; parent.session.receive( {to:&quot;session&quot;, do:&quot;test&quot;, text:&quot;Hello world&quot;} ); </script></head></html>
  • 11. The Very First JSON Message April 2001 <html><head><script> document.domain = 'fudco.com'; parent.session.receive( {to:&quot;session&quot;, do :&quot;test&quot;, text:&quot;Hello world&quot;} ); </script></head></html>
  • 12. The unquoted name problem ES3 has a wack reserved word policy. Reserved words must be quoted. I did not want to put the list of reserved words in the JSON spec, so... All keys must be quoted. It significantly simplified JSON. This conforms to Python.
  • 13. Nested HTML <html><head><script> document.domain = 'fudco.com'; parent.session.receive( {&quot; to &quot;:&quot;session&quot;, &quot; do &quot;:&quot;test&quot;, &quot; text &quot;:&quot; </script> &quot;} ); </script></head></html>
  • 14. Nested HTML <html><head><script> document.domain = 'fudco.com'; parent.session.receive( {&quot; to &quot;:&quot;session&quot;, &quot; do &quot;:&quot;test&quot;, &quot; text &quot;:&quot;< \ /script>&quot;} ); </script></head></html>
  • 17. JSON was really useful Browser/server communication. Interserver communication. JSON database.
  • 18. Our customers said “Never heard of it.” “Sorry, our company just committed to XML.” “It is not a standard.”
  • 19. I bought JSON.org A one-page web site that described JSON. Grammar three ways Simplified BNF Railroad diagrams Informal English A Java reference implementation. And then I retired.
  • 20. And that’s all I did. A message format in a bottle.
  • 22. Languages ActionScript C C++ C# ColdFusion D Delphi E Eiffel Erlang Fan Flex Haskell haXe Java JavaScript Lasso Lisp LotusScript Lua Objective C Objective CAML OpenLaszlo Perl PHP Pike pl/sql PowerShell Prolog Python R REALbasic Rebol Ruby Scheme Squeak Tcl Visual Basic Visual FoxPro
  • 23. JSON is the intersection of modern programming languages Simple values number string boolean Sequence of values array, vector, list Collection of named values object, record, struct, hash, property list
  • 24. Recursive descent value = function () { // Parse a JSON value. It could be an object, an array, // a string, a number, or a word. white(); switch (ch) { case '{': return object(); case '[': return array(); case '&quot;': return string(); case '-': return number(); default: return ch >= '0' && ch <= '9' ? number() : word(); } };
  • 25. State Machine state = 'go'; stack = []; try { for (;;) { r = tx.exec(source); if (!r) { break; } if (r[1]) { action[r[1]][state](); } else if (r[2]) { value = +r[2]; number[state](); } else { value = debackslashify(r[3]); string[state](); } source = source.slice(r[0].length); } }
  • 26. Eval if ( /^[\],:{}\s]*$/ .test(text.replace( /\\(?:[&quot;\\\/bfnrt]|u[0-9a-fA-F]{4})/g , '@').replace( /&quot;[^&quot;\\\n\r]*&quot;|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g , ']'). replace( /(?:^|:|,)(?:\s*\[)+/g , ''))) { // In the third stage we use the eval function to compile the // text into a JavaScript structure. The '{' operator is subject // to a syntactic ambiguity in JavaScript: it can begin a block // or an object literal. We wrap the text in parens to eliminate // the ambiguity. j = eval ('(' + text + ')');
  • 27. JSON.parse Part of ECMAScript, Fifth Edition Available now in better browsers everywhere. Very fast. Very reliable.
  • 28. Languages Arabic Bulgarian Chinese Czech Dutch French German Greek Hebrew Hungarian Indonesian Italian Japanese Korean Persian Polish Portuguese Russian Slovenian Spanish Turkish Vietnamese
  • 30. Improvements Removed comments. Dangerous practices Unnecessary complexity Alignment with YAML Added e notation to numbers.
  • 31. No version number. JSON will not be changed. Stability is more important than any feature we can think of. Perhaps someday it will be replaced.
  • 32. Minimalism It can fit on the back of a business card.
  • 35. Rebol
  • 38. XML The High Priced Spread
  • 39. HTML Always bet on angle brackets.
  • 40. Ask not if it is good enough. Ask if it can be popular enough.
  • 41. Maybe only something this simple could work. John Seely Brown, April 2002
  • 42. Maybe only something this complicated could work. 2002
  • 43. XMLsucks.org Why XML is technologically terrible, but you have to use it anyway
  • 44. XML is the standard so shut up. SHUT UP!
  • 45. XML Alternatives JSON config YAML CanonML HDF SSYN OGDL SDL DL Boulder ONX SMEL Property lists ConfigObj GroovyMarkup ATerms LNML GODDAG JITTs Esis/Pyxie ConciseXML SML TexMecs A specification language Waterken doc UBF Xqueeze Ool atx Grutatxt APT txt2docbook txt2tags AsciiDoc reStructuredText Epytext EtText AFT txt2html Setext Latte Confluence Markdown SmartyPants Textile Atox CDuce MarkupMatrix WikiMl IWML SEXP sfsexp Lambda markup language SXML Better markup tXML SOX SLiP ezex Tanga (NBML) XSLScript & TerseXML Lx NiceXSL PXSL ShoXS XSCS SML MIN MINML ESPX PXML GMarkup ASN BLOB SDXF CTX ASDL WDDX REBOL http://www.pault.com/pault/pxml/xmlalternatives.html
  • 47. It’s not even XML! Who did this travesty? Let’s find a tree and string them up. Now. Dave Winer, 2006-12-20
  • 48. any damn fool could produce a better data format than XML James Clark, 2007-04-06
  • 49. Use the right tool for the right job. When your only tool is a wrench, every problem looks like a nail.
  • 50. Where did the idea come from that data should be represented by a document format?
  • 51. RUNOFF .SK 1 Text processing and word processing systems typically require additional information to be interspersed among the natural text of the document being processed. This added information, called &quot;markup&quot;, serves two purposes: .TB 4 .OF 4 .SK 1 1.#Separating the logical elements of the document; and .OF 4 .SK 1 2.#Specifying the processing functions to be performed on those elements. .OF 0 .SK 1
  • 52. GML :h1.Chapter 1: Introduction :p.GML supported hierarchical containers, such as :ol :li.Ordered lists (like this one), :li.Unordered lists, and :li.Definition lists :eol. as well as simple structures. :p.Markup minimization (later generalized and formalized in SGML), allowed the end-tags to be omitted for the &quot;h1&quot; and &quot;p&quot; elements.
  • 54. Brian Reid’s Scribe @Quote(Any damn fool) ( ) [ ] { } < > &quot; &quot; ' ' @Begin(Quote) Any damn fool @End(Quote) 1980
  • 55. Scribe @techreport(PUB, key=&quot;Tesler&quot;, author=&quot;Tesler, Larry&quot;, title=&quot;PUB: The Document Compiler&quot;, year=1972, number=&quot;ON-72&quot;, month=&quot;Sep&quot;, institution=&quot;Stanford University Artificial Intelligence Project&quot;) @book(Volume3, key=&quot;Knuth&quot;, author=&quot;Knuth, Donald E.&quot;, title=&quot;Sorting and Searching&quot;, publisher=&quot;Addison-Wesley&quot;, year=1973, volume=3, series=&quot;The Art of Computer Programming&quot;, address=&quot;Reading, Mass.&quot;)
  • 56. License The Software shall be used for Good, not Evil.
  • 57. I give permission to IBM, its customers, partners, and minions, to use JSLint for evil. Thanks very much, Douglas! Staff Attorney, IP Law IBM Corporation
  • 61.  
  • 62.  
  • 63.  
  • 64.