A Collection of What's Next for Awesome JSON (JavaScript Object Notation) for Structured (Meta) Data in Text - JSON5, HJSON, HanSON, TJSON, SON, CSON, USON, JSONX/JSON11 & Many More
JSON5 • HJSON • HanSON • SON • TJSON • CSON • USON • JSONX • JSON11 • JSON XI • JSONII • JSON Lines • NDJSON • HOCON • HCL • UCL
A Collection of What's Next for Awesome JSON (JavaScript Object Notation) for structured (meta) data in text.
More:
''
instead of ""
)
\
or "
etc. To escape '
use '''
e.g. ''''Henry's Themes'''
set
, map
, symbol
, etc.)Fixing JSON - Comments, Please!
We can easily agree on what’s wrong with JSON, and I can't help wondering if it'd be worth fixing it.
-- Tim Bray (Fixing JSON)
XML already does everything JSON does! And there's no way to differentiate between nodes and attributes! And there are no namespaces! And no schemas! What's the point of JSON?
-- Anonymous
We need to fix engineers that try to 'fix JSON', absolutely nothing is broken with JSON.
-- Anonymous
JSON5 • HJSON • HanSON • SON • JSONX • CSON • USON
Modern JSON - JSON for the ES5 Era
JSON for "Humans" (not Machines). Adds:
// This file is written in JSON5 syntax, naturally, but npm needs a regular
// JSON file, so compile via `npm run build`. Be sure to keep both in sync!
{
name: 'json5',
version: '0.5.0',
description: 'JSON for the ES5 era.',
keywords: ['json', 'es5'],
author: 'Aseem Kishore <[email protected]>',
contributors: [
// TODO: Should we remove this section in favor of GitHub's list?
// https://github.com/json5/json5/contributors
'Max Nanasy <[email protected]>',
'Andrew Eisenberg <[email protected]>',
'Jordan Tucker <[email protected]>',
],
main: 'lib/json5.js',
bin: 'lib/cli.js',
files: ["lib/"],
dependencies: {},
devDependencies: {
gulp: "^3.9.1",
'gulp-jshint': "^2.0.0",
jshint: "^2.9.1",
'jshint-stylish': "^2.1.0",
mocha: "^2.4.5"
},
scripts: {
build: 'node ./lib/cli.js -c package.json5',
test: 'mocha --ui exports --reporter spec',
// TODO: Would it be better to define these in a mocha.opts file?
},
homepage: 'http://json5.org/',
license: 'MIT',
repository: {
type: 'git',
url: 'https://github.com/json5/json5',
},
}
A "Human" User Interface for JSON
{
// use #, // or /**/ comments,
// omit quotes for keys
key: 1
// omit quotes for strings
contains: everything on this line
// omit commas at the end of a line
cool: {
foo: 1
bar: 2
}
// allow trailing commas
list: [
1,
2,
]
// and use multiline strings
realist:
'''
My half empty glass,
I will fill your empty half.
Now you are half full.
'''
}
JSON for Humans
github: timjansen/hanson
Adds:
//
, /**/
).""
) or single-quotes (''
) for single-line strings.{
listName: "Sesame Street Monsters", // note that listName needs no quotes
content: [
{
name: "Cookie Monster",
/* Note the template quotes and unescaped regular quotes in the next string */
background: `Cookie Monster used to be a
monster that ate everything, especially cookies.
These days he is forced to eat "healthy" food.`
}, {
// You can single-quote strings too:
name: 'Herry Monster',
background: `Herry Monster is a furry blue monster with a purple nose.
He's mostly retired today.`
}, // don't worry, the trailing comma will be ignored
]
}
Simple Object Notation
github: aleksandergurin/simple-object-notation
Adds:
{
# Personal information
"name": "Alexander Grothendieck"
"fields": "mathematics"
"main_topics": [
"Etale cohomology"
"Motives"
"Topos theory"
"Schemes"
]
}
JSON with Extensions (JSONX) or JSON v1.1 (a.k.a. JSON11 or JSON XI or JSON II) - JSON Evolved for Humans - Easy-to-Write, Easy-to-Read
github: json-next
JSON v1.1 includes all JSON extensions from HanSON (JSON for Humans):
''
) are supported in addition to double quotes (""
)//
) and multi-line comments (/* */
), in all places where JSON allows whitespace.Plus all JSON extensions from SON (Simple Object Notation):
#
sign and ends with newline (\n
)Example:
{
# use shell-like comments
listName: "Sesame Street Monsters" # note: comments after key-value pairs are optional
content: [
{
name: "Cookie Monster"
// note: the template quotes and unescaped regular quotes in the next string
background: `Cookie Monster used to be a
monster that ate everything, especially cookies.
These days he is forced to eat "healthy" food.`
}, {
// You can single-quote strings too:
name: 'Herry Monster',
background: `Herry Monster is a furry blue monster with a purple nose.
He's mostly retired today.`
}, /* don't worry, the trailing comma will be ignored */
]
}
Cursive Script Object Notation (CSON). A strict superset of JavaScript Object Notation (JSON) that can be written by hand (hence the name) and translated to a canonical JSON
github: lifthrasiir/cson - designed by Kang Seonghoon
CSON:
# CSON data example
hello =
|world
| ...and goodbye
the = ['answer', 'is'
42]
same as:
{
"hello": "world\n ...and goodbye",
"the": ["answer", "is",
42]
}
CoffeeScript-Object-Notation. Same as JSON but for CoffeeScript objects
github: bevry/cson
CSON:
# Comments!!!
# An Array with no commas!
greatDocumentaries: [
'earthlings.com'
'forksoverknives.com'
'cowspiracy.com'
]
# An Object without braces!
importantFacts:
# Multi-Line Strings! Without Quote Escaping!
emissions: '''
Livestock and their byproducts account for at least 32,000 million tons of carbon dioxide (CO2) per year, or 51% of all worldwide greenhouse gas emissions.
Goodland, R Anhang, J. “Livestock and Climate Change: What if the key actors in climate change were pigs, chickens and cows?”
WorldWatch, November/December 2009. Worldwatch Institute, Washington, DC, USA. Pp. 10–19.
http://www.worldwatch.org/node/6294
'''
landuse: '''
Livestock covers 45% of the earth’s total land.
Thornton, Phillip, Mario Herrero, and Polly Ericksen. “Livestock and Climate Change.” Livestock Exchange, no. 3 (2011).
https://cgspace.cgiar.org/bitstream/handle/10568/10601/IssueBrief3.pdf
'''
burger: '''
One hamburger requires 660 gallons of water to produce – the equivalent of 2 months’ worth of showers.
Catanese, Christina. “Virtual Water, Real Impacts.” Greenversations: Official Blog of the U.S. EPA. 2012.
http://blog.epa.gov/healthywaters/2012/03/virtual-water-real-impacts-world-water-day-2012/
“50 Ways to Save Your River.” Friends of the River.
http://www.friendsoftheriver.org/site/PageServer?pagename=50ways
'''
milk: '''
1,000 gallons of water are required to produce 1 gallon of milk.
“Water trivia facts.” United States Environmental Protection Agency.
http://water.epa.gov/learn/kids/drinkingwater/water_trivia_facts.cfm#_edn11
'''
more: 'http://cowspiracy.com/facts'
same as:
{
"greatDocumentaries": [
"earthlings.com",
"forksoverknives.com",
"cowspiracy.com"
],
"importantFacts": {
"emissions": "Livestock and their byproducts account for at least 32,000 million tons of carbon dioxide (CO2) per year, or 51% of all worldwide greenhouse gas emissions.\nGoodland, R Anhang, J. “Livestock and Climate Change: What if the key actors in climate change were pigs, chickens and cows?”\nWorldWatch, November/December 2009. Worldwatch Institute, Washington, DC, USA. Pp. 10–19.\nhttp://www.worldwatch.org/node/6294",
"landuse": "Livestock covers 45% of the earth’s total land.\nThornton, Phillip, Mario Herrero, and Polly Ericksen. “Livestock and Climate Change.” Livestock Exchange, no. 3 (2011).\nhttps://cgspace.cgiar.org/bitstream/handle/10568/10601/IssueBrief3.pdf",
"burger": "One hamburger requires 660 gallons of water to produce – the equivalent of 2 months’ worth of showers.\nCatanese, Christina. “Virtual Water, Real Impacts.” Greenversations: Official Blog of the U.S. EPA. 2012.\nhttp://blog.epa.gov/healthywaters/2012/03/virtual-water-real-impacts-world-water-day-2012/\n“50 Ways to Save Your River.” Friends of the River.\nhttp://www.friendsoftheriver.org/site/PageServer?pagename=50ways",
"milk": "1,000 gallons of water are required to produce 1 gallon of milk.\n“Water trivia facts.” United States Environmental Protection Agency.\nhttp://water.epa.gov/learn/kids/drinkingwater/water_trivia_facts.cfm#_edn11",
"more": "http://cowspiracy.com/facts"
}
}
μson - A compact human-readable data serialization format specially designed for shell
github: burningtree/uson
Principles:
"
is optional.,
can be replaced by whitespace
.:
can be repeated to create nested objects.!
character.USON:
number:12.05 text:Banana quotedText:"John Devilseed" empty:null good:true
same as:
{
"number": 12.05,
"text": "Banana",
"quotedText": "John Devilseed",
"empty": null,
"good": true
}
USON:
simple:[1 2 3] texts:[Malta Budapest "New York"] objects:[{id:1}]
same as:
{
"simple": [
1,
2,
3
],
"texts": [
"Malta",
"Budapest",
"New York"
],
"objects": [
{
"id": 1
}
]
}
Tagged JSON with Rich Type Annotations
A tagging scheme/microformat for enriching the types stored in self-describing, schema-free JSON documents.
Why? Enables "content-aware hashing" where different encodings of the same data (including both TJSON and binary formats like Protocol Buffers, MessagePack, BSON, etc) share the same content hash and therefore the same cryptographic signature.
TJSON supports the following data types:
Examples:
{
"array-example:A<O>": [
{
"string-example:s": "Hello, world!",
"binary-data-example:d": "QklOQVJZ",
"float-example:f": 0.42,
"int-example:i": "42",
"timestamp-example:t": "2020-11-06T22:27:34Z",
"boolean-example:b": true
}
],
"set-example:S<i>": [1, 2, 3]
}
One Line, One Data Record
web: jsonlines.org
One Line, One Record - Newline (nl or \n) Separated
["Name", "Session", "Score", "Completed"]
["Gilbert", "2013", 24, true]
["Alexa", "2013", 29, true]
["May", "2012B", 14, false]
["Deloise", "2012A", 19, true]
Pros:
or nested data records e.g.
{"name": "Gilbert", "wins": [["straight", "7♣"], ["one pair", "10♥"]]}
{"name": "Alexa", "wins": [["two pair", "4♠"], ["two pair", "9♠"]]}
{"name": "May", "wins": []}
{"name": "Deloise", "wins": [["three of a kind", "5♣"]]}
Newline Delmited JSON
web: ndjson.org, github: ndjson
{"some":"thing"}
{"foo":17,"bar":false,"quux":true}
{"may":{"include":"nested","objects":["and","arrays"]}}
(Source: specs.okfnlabs.org/ndjson)
: = {} []
Human-Optimized Config Object Notation
github: typesafehub/config/HOCON
HashiCorp Configuration Language
github: hashicorp/hcl
Universal Configuration Language
github: vstakhov/libucl
AXON is eXtended Object Notation
web: intellimath.bitbucket.io/axon
Objective Markup Notation, abbreviated as Mark or {mark} - a unified notation for both object and markup data
web: mark.js.org, github: henry-luo/mark
See Format Extensions, Supersets and Related Formats in Awesome JSON (@burningtree)
License
The awesome list is dedicated to the public domain. Use it as you please with no restrictions whatsoever.
Questions? Comments?
Post them to the wwwmake forum. Thanks!