JSON and Beyond JSON: The World’s Best Loved Data
Description: JSON and Beyond JSON: The Worlds Best Loved Data Interchange Format JSON Design Rules Minimal Textual Subset of JavaScript The good thing about reinventing the wheel is that you can get a round one. JSON,XML
Related Topics
Download Presentation
"JSON and Beyond JSON: The World’s Best Loved Data" is the property of its rightful owner. Permission is granted to download and print the materials on this website for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Presentation Transcript
slide1. JSON and Beyond<br>
slide2. JSON: The World’s Best Loved Data Interchange Format<br>
slide3. JSON Design Rules Minimal
Textual
Subset of JavaScript<br>
slide4. The good thing about reinventing the wheel is that you can get a round one.<br>
slide5. JSON,XML https://trends.google.com/trends/explore?date=all&q=json,xml<br>
slide6. Advice to data format standard designers Don’t break JSON.
Make it significantly better.
Get a better name.<br>
slide7. Regrets I’ve had a few<br>
slide8. Values<br>
slide9. Values<br>
slide10. Number<br>
slide11. Number<br>
slide12. String<br>
slide13. String<br>
slide14. UTF-16 xxxxxxxxxxxxxxxx
110110xxxxxxxxxx 110111xxxxxxxxxx 16
21<br>
slide15. UTF-16 xxxxxxxxxxxxxxxx
110110xxxxxxxxxx 110111xxxxxxxxxx
00000000000xxxxxxxxxxxxxxxxxxxxx 16
21
32 UTF-32<br>
slide16. UTF-8 0xxxxxxx
110xxxxx 10xxxxxx
1110xxxx 10xxxxxx 10xxxxxx
11110xxx 10xxxxxx 10xxxxxx 10xxxxxx 7
11
16
21<br>
slide17. KIM Keep it minimal.
Variable byte encoding.
Seventh bit continuation.<br>
slide18. KIM 0xxxxxxx
1xxxxxxx 0xxxxxxx
1xxxxxxx 1xxxxxxx 0xxxxxxx
1xxxxxxx 1xxxxxxx 1xxxxxxx 0xxxxxxx
1xxxxxxx 1xxxxxxx 1xxxxxxx 1xxxxxxx 0xxxxxxx
1xxxxxxx 1xxxxxxx 1xxxxxxx 1xxxxxxx 1xxxxxxx 0xxxxxxx 7
14
21
28
35
42
⋮<br>
slide19. KIM saves one byte per character Aramaic, Avestan, Balinese, Batak, Bopomofo, Buginese, Buhid, Carian, Cherokee, Coptic, Cyrillic, Deseret, Egyptian Hieroglyphs, Ethiopic, Georgian, Glagolitic, Gothic, Hangul Jamo, Hanunoo, Hiragana, Kanbun, Kaithi, Kannada, Katakana, Kharoshthi, Khmer, Lao, Lepcha, Limbu, Lycian, Lydian, Malayalam, Mandaic, Meroitic, Miao, Mongolian, Myanmar, New Tai Lue, Ol Chiki, Old South Arabian, Old Turkic, Oriya, Osmanya, Pahlavi, Parthian, Phags-Pa, Phoenician, Samaritan, Sharada, Sinhala, Sora Sompeng, Tagalog, Tagbanwa, Takri, Tai Le, Tai Tham, Tamil, Telugu, Thai, Tibetan, Tifinagh, Unified Canadian Aboriginal Syllabics<br>
slide20. Misty<br>
slide21. Nota JSON-like binary encoding with blobs and private process addresses Message Format<br>
slide22. Nota Design Rules Keep the good parts of JSON: minimal and general
Loose coupling.
Blobs (binary large objects)
Encryption keys
Network addresses
Pixels and sounds
Compression and encryption<br>
slide23. Nota Blob c000 xxxx The blob’s bits follow, rounded up to a byte
xxxx is the top 4 bits of the number of bits in the blob
c is 1 if the number of bits is continued
The contents of the blob follow as a stream bytes.
nr_bytes = (nr_blob_bits + 7) / 8<br>
slide24. Nota Blob c000 xxxx The blob’s bits follow, rounded up to a byte
xxxx is the top 4 bits of the number of bits in the blob
c is 1 if the number of bits is continued
Example: Blob of length 521 (10 0000 1001)<br>
slide25. Blob c000 xxxx The blob’s bits follow, rounded up to a byte
xxxx is the top 4 bits of the number of bits in the blob
c is 1 if the number of bits is continued
Example: Blob of length 521 (10 0000 1001)
c000 xxxx Nota<br>
slide26. Blob c000 xxxx The blob’s bits follow, rounded up to a byte
xxxx is the top 4 bits of the number of bits in the blob
c is 1 if the number of bits is continued
Example: Blob of length 521 (10 0000 1001)
1000 xxxx 0xxx xxxx Nota<br>
slide27. Nota Blob c000 xxxx The blob’s bits follow, rounded up to a byte
xxxx is the top 4 bits of the number of bits in the blob
c is 1 if the number of bits is continued
Example: Blob of length 521 (10 0000 1001)
1000 0100 0000 1001 # blob 521 then 67 bytes<br>
slide28. Nota Blob c000 xxxx followed by bits
Text c001 xxxx followed by KIM characters<br>
slide29. Nota Blob c000 xxxx followed by bits
Text c001 xxxx followed by KIM characters
Array c010 xxxx followed by elements<br>
slide30. Nota Blob c000 xxxx followed by bits
Text c001 xxxx followed by KIM characters
Array c010 xxxx followed by elements
Record c011 xxxx followed by text value pairs<br>
slide31. Nota Floating c10e sxxx an integer exponent and Point an integer coefficient
floating_point_number = coefficient * (10 ** exponent)
Like scientific notation without decimal points.
This efficiently delivers the same subset of the real numbers as JSON.<br>
slide32. Nota Floating c10e sxxx an integer exponent andPoint an integer coefficient xxx is 3 bits of the exponent
c is 1 if the exponent is continued
e is the sign of the exponent
s is the sign of the coefficient<br>
slide33. Floating c10e sxxx an integer exponent andPoint an integer coefficient xxx is 3 bits of the exponent
c is 1 if the exponent is continued
e is the sign of the exponent
s is the sign of the coefficient
Example: -0.014576 = -14576e-6 (11 1000 1111 0000 e 110)
5E F1 70 = c10e sxxx 1xxx xxxx 0xxx xxxx Nota<br>
slide34. Floating c10e sxxx an integer exponent andPoint an integer coefficient xxx is 3 bits of the exponent
c is 1 if the exponent is continued
e is the sign of the exponent
s is the sign of the coefficient
Example: -0.014576 = -14576e-6 (11 1000 1111 0000 e 110)
5E F1 70 = 0101 s110 1xxx xxxx 0xxx xxxx Nota<br>
slide35. Nota Floating c10e sxxx an integer exponent andPoint an integer coefficient xxx is 3 bits of the exponent
c is 1 if the exponent is continued
e is the sign of the exponent
s is the sign of the coefficient
Example: -0.014576 = -14576e-6 (11 1000 1111 0000 e 110)
5E F1 70 = 0101 1110 1111 0001 0111 0000<br>
slide36. Integer c110 sxxx
xxx is 3 bits of the integer
c is 1 if the integer is continued
s is the sign of the integer
Example: -5 (101) 666 (10 1001 1010)
65 E5 1A = 0110 1xxx 1110 0xxx 0xxx xxxx Nota<br>
slide37. Integer c110 sxxx
xxx is 3 bits of the integer
c is 1 if the integer is continued
s is the sign of the integer
Example: -5 (101) 666 (10 1001 1010)
65 E5 1A = 0110 1101 1110 0101 0001 1010 Nota<br>
slide38. Nota Symbol 0111 xxxx
0111 0000 0x70 # false 0111 0001 0x71 # true 0111 1000 0x78 # private 0111 1001 0x79 # system<br>
slide39. Nota Types Floating Point c10e sxxxInteger c110 sxxxSymbol 0111 xxxx Blob c000 xxxx
Text c001 xxxx
Array c010 xxxx
Record c011 xxxx<br>
slide40. Misty The Misty System will use Nota to send inter-process messages across the network.
The Misty Language will not provide direct access to Nota.
The Misty Language will provide JSON.<br>
slide41. Nota Nota does what JSON does.
Nota is not intended to replace JSON.
Nota is not human readable.
Nota is more compact.
Nota is faster to encode/decode.
Nota may have applications besides Misty.
https://www.crockford.com/nota.html<br>
slide42. And finally, one piece of advice:
Don’t make bugs.<br>
slide43. Thank you and good night. fitc.ca/ask<br>
slide44. The Procession Protocol Sequel to The Seif Protocol<br>
slide45. UTF-8 0xxxxxxx
110xxxxx 10xxxxxx
1110xxxx 10xxxxxx 10xxxxxx
11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
111111xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 7
11
16
21
26
32<br>
slide2. JSON: The World’s Best Loved Data Interchange Format<br>
slide3. JSON Design Rules Minimal
Textual
Subset of JavaScript<br>
slide4. The good thing about reinventing the wheel is that you can get a round one.<br>
slide5. JSON,XML https://trends.google.com/trends/explore?date=all&q=json,xml<br>
slide6. Advice to data format standard designers Don’t break JSON.
Make it significantly better.
Get a better name.<br>
slide7. Regrets I’ve had a few<br>
slide8. Values<br>
slide9. Values<br>
slide10. Number<br>
slide11. Number<br>
slide12. String<br>
slide13. String<br>
slide14. UTF-16 xxxxxxxxxxxxxxxx
110110xxxxxxxxxx 110111xxxxxxxxxx 16
21<br>
slide15. UTF-16 xxxxxxxxxxxxxxxx
110110xxxxxxxxxx 110111xxxxxxxxxx
00000000000xxxxxxxxxxxxxxxxxxxxx 16
21
32 UTF-32<br>
slide16. UTF-8 0xxxxxxx
110xxxxx 10xxxxxx
1110xxxx 10xxxxxx 10xxxxxx
11110xxx 10xxxxxx 10xxxxxx 10xxxxxx 7
11
16
21<br>
slide17. KIM Keep it minimal.
Variable byte encoding.
Seventh bit continuation.<br>
slide18. KIM 0xxxxxxx
1xxxxxxx 0xxxxxxx
1xxxxxxx 1xxxxxxx 0xxxxxxx
1xxxxxxx 1xxxxxxx 1xxxxxxx 0xxxxxxx
1xxxxxxx 1xxxxxxx 1xxxxxxx 1xxxxxxx 0xxxxxxx
1xxxxxxx 1xxxxxxx 1xxxxxxx 1xxxxxxx 1xxxxxxx 0xxxxxxx 7
14
21
28
35
42
⋮<br>
slide19. KIM saves one byte per character Aramaic, Avestan, Balinese, Batak, Bopomofo, Buginese, Buhid, Carian, Cherokee, Coptic, Cyrillic, Deseret, Egyptian Hieroglyphs, Ethiopic, Georgian, Glagolitic, Gothic, Hangul Jamo, Hanunoo, Hiragana, Kanbun, Kaithi, Kannada, Katakana, Kharoshthi, Khmer, Lao, Lepcha, Limbu, Lycian, Lydian, Malayalam, Mandaic, Meroitic, Miao, Mongolian, Myanmar, New Tai Lue, Ol Chiki, Old South Arabian, Old Turkic, Oriya, Osmanya, Pahlavi, Parthian, Phags-Pa, Phoenician, Samaritan, Sharada, Sinhala, Sora Sompeng, Tagalog, Tagbanwa, Takri, Tai Le, Tai Tham, Tamil, Telugu, Thai, Tibetan, Tifinagh, Unified Canadian Aboriginal Syllabics<br>
slide20. Misty<br>
slide21. Nota JSON-like binary encoding with blobs and private process addresses Message Format<br>
slide22. Nota Design Rules Keep the good parts of JSON: minimal and general
Loose coupling.
Blobs (binary large objects)
Encryption keys
Network addresses
Pixels and sounds
Compression and encryption<br>
slide23. Nota Blob c000 xxxx The blob’s bits follow, rounded up to a byte
xxxx is the top 4 bits of the number of bits in the blob
c is 1 if the number of bits is continued
The contents of the blob follow as a stream bytes.
nr_bytes = (nr_blob_bits + 7) / 8<br>
slide24. Nota Blob c000 xxxx The blob’s bits follow, rounded up to a byte
xxxx is the top 4 bits of the number of bits in the blob
c is 1 if the number of bits is continued
Example: Blob of length 521 (10 0000 1001)<br>
slide25. Blob c000 xxxx The blob’s bits follow, rounded up to a byte
xxxx is the top 4 bits of the number of bits in the blob
c is 1 if the number of bits is continued
Example: Blob of length 521 (10 0000 1001)
c000 xxxx Nota<br>
slide26. Blob c000 xxxx The blob’s bits follow, rounded up to a byte
xxxx is the top 4 bits of the number of bits in the blob
c is 1 if the number of bits is continued
Example: Blob of length 521 (10 0000 1001)
1000 xxxx 0xxx xxxx Nota<br>
slide27. Nota Blob c000 xxxx The blob’s bits follow, rounded up to a byte
xxxx is the top 4 bits of the number of bits in the blob
c is 1 if the number of bits is continued
Example: Blob of length 521 (10 0000 1001)
1000 0100 0000 1001 # blob 521 then 67 bytes<br>
slide28. Nota Blob c000 xxxx followed by bits
Text c001 xxxx followed by KIM characters<br>
slide29. Nota Blob c000 xxxx followed by bits
Text c001 xxxx followed by KIM characters
Array c010 xxxx followed by elements<br>
slide30. Nota Blob c000 xxxx followed by bits
Text c001 xxxx followed by KIM characters
Array c010 xxxx followed by elements
Record c011 xxxx followed by text value pairs<br>
slide31. Nota Floating c10e sxxx an integer exponent and Point an integer coefficient
floating_point_number = coefficient * (10 ** exponent)
Like scientific notation without decimal points.
This efficiently delivers the same subset of the real numbers as JSON.<br>
slide32. Nota Floating c10e sxxx an integer exponent andPoint an integer coefficient xxx is 3 bits of the exponent
c is 1 if the exponent is continued
e is the sign of the exponent
s is the sign of the coefficient<br>
slide33. Floating c10e sxxx an integer exponent andPoint an integer coefficient xxx is 3 bits of the exponent
c is 1 if the exponent is continued
e is the sign of the exponent
s is the sign of the coefficient
Example: -0.014576 = -14576e-6 (11 1000 1111 0000 e 110)
5E F1 70 = c10e sxxx 1xxx xxxx 0xxx xxxx Nota<br>
slide34. Floating c10e sxxx an integer exponent andPoint an integer coefficient xxx is 3 bits of the exponent
c is 1 if the exponent is continued
e is the sign of the exponent
s is the sign of the coefficient
Example: -0.014576 = -14576e-6 (11 1000 1111 0000 e 110)
5E F1 70 = 0101 s110 1xxx xxxx 0xxx xxxx Nota<br>
slide35. Nota Floating c10e sxxx an integer exponent andPoint an integer coefficient xxx is 3 bits of the exponent
c is 1 if the exponent is continued
e is the sign of the exponent
s is the sign of the coefficient
Example: -0.014576 = -14576e-6 (11 1000 1111 0000 e 110)
5E F1 70 = 0101 1110 1111 0001 0111 0000<br>
slide36. Integer c110 sxxx
xxx is 3 bits of the integer
c is 1 if the integer is continued
s is the sign of the integer
Example: -5 (101) 666 (10 1001 1010)
65 E5 1A = 0110 1xxx 1110 0xxx 0xxx xxxx Nota<br>
slide37. Integer c110 sxxx
xxx is 3 bits of the integer
c is 1 if the integer is continued
s is the sign of the integer
Example: -5 (101) 666 (10 1001 1010)
65 E5 1A = 0110 1101 1110 0101 0001 1010 Nota<br>
slide38. Nota Symbol 0111 xxxx
0111 0000 0x70 # false 0111 0001 0x71 # true 0111 1000 0x78 # private 0111 1001 0x79 # system<br>
slide39. Nota Types Floating Point c10e sxxxInteger c110 sxxxSymbol 0111 xxxx Blob c000 xxxx
Text c001 xxxx
Array c010 xxxx
Record c011 xxxx<br>
slide40. Misty The Misty System will use Nota to send inter-process messages across the network.
The Misty Language will not provide direct access to Nota.
The Misty Language will provide JSON.<br>
slide41. Nota Nota does what JSON does.
Nota is not intended to replace JSON.
Nota is not human readable.
Nota is more compact.
Nota is faster to encode/decode.
Nota may have applications besides Misty.
https://www.crockford.com/nota.html<br>
slide42. And finally, one piece of advice:
Don’t make bugs.<br>
slide43. Thank you and good night. fitc.ca/ask<br>
slide44. The Procession Protocol Sequel to The Seif Protocol<br>
slide45. UTF-8 0xxxxxxx
110xxxxx 10xxxxxx
1110xxxx 10xxxxxx 10xxxxxx
11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
111111xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 7
11
16
21
26
32<br>