Home

Awesome

JSON5 • HJSON • HanSON • SON • TJSON • CSON • USON • JSONX • JSON11 • JSON XI • JSONII • JSON Lines • NDJSON • HOCON • HCL • UCL

Awesome JSON - What's Next?

A Collection of What's Next for Awesome JSON (JavaScript Object Notation) for structured (meta) data in text.

Contributions welcome. Anything missing? Send in a pull request. Thanks.

What's Missing in JSON?

  1. Comments, Comments, Comments
  2. Unquoted Keys
  3. Multi-Line Strings
    • a) Folded -- Folds Newlines
    • b) Unfolded
  4. Trailing Commas in Arrays and Objects

More:

Discussion

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)

<!-- break -->

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

<!-- break -->

We need to fix engineers that try to 'fix JSON', absolutely nothing is broken with JSON.

-- Anonymous

<!-- break -->

What's Next?

JSON5HJSONHanSONSONJSONXCSONUSON

JSON5

Modern JSON - JSON for the ES5 Era

web: json5.org, github: json5

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 <aseem.kishore@gmail.com>',
    contributors: [
        // TODO: Should we remove this section in favor of GitHub's list?
        // https://github.com/json5/json5/contributors
        'Max Nanasy <max.nanasy@gmail.com>',
        'Andrew Eisenberg <andrew@eisenberg.as>',
        'Jordan Tucker <jordanbtucker@gmail.com>',
    ],
    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',
    },
}

HJSON

A "Human" User Interface for JSON

web: hjson.org, github: hjson

{
  // 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.
    '''
}

HanSON

JSON for Humans

github: timjansen/hanson

Adds:

{
  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
   ]
}

SON

Simple Object Notation

github: aleksandergurin/simple-object-notation

Adds:

{
  # Personal information
    
  "name": "Alexander Grothendieck"
  "fields": "mathematics"
  "main_topics": [
    "Etale cohomology"
    "Motives"
    "Topos theory"
    "Schemes"
  ]
}

JSONX

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):

Plus all JSON extensions from SON (Simple Object Notation):

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  */
   ]
}

CSON (I)

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]
}

CSON (II)

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"
  }
}

USON

μson - A compact human-readable data serialization format specially designed for shell

github: burningtree/uson

Principles:

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
    }
  ]
}

JSON with (Rich) Types

TJSON

Tagged JSON with Rich Type Annotations

web: tjson.org, github: tjson

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]
}

JSON is the New CSV - JSON Formats for Line-Oriented Tables / Records

One Line, One Data Record

JSON LinesNDJSON

JSON Lines

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♣"]]}

NDJSON

Newline Delmited JSON

web: ndjson.org, github: ndjson

  1. Line Separator is '\n'
  2. Each Line is a valid JSON Value
{"some":"thing"}
{"foo":17,"bar":false,"quux":true}
{"may":{"include":"nested","objects":["and","arrays"]}}

(Source: specs.okfnlabs.org/ndjson)

More Formats

: = {} []

HOCON

Human-Optimized Config Object Notation

github: typesafehub/config/HOCON

HCL

HashiCorp Configuration Language

github: hashicorp/hcl

UCL

Universal Configuration Language

github: vstakhov/libucl

AXON

AXON is eXtended Object Notation

web: intellimath.bitbucket.io/axon

Objective Markup Notation - {mark}

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

And More

See Format Extensions, Supersets and Related Formats in Awesome JSON (@burningtree)

Articles

Meta

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!