Hello everyone!
After roughly 5 weeks of writing and lots & lots of thinking and tinkering, I finally finished the file format specification for a format I invented: XHON.
The name is a amalgation of ‘XML’ and ‘JSON’ and means ‘eXtensible Human Object Notation’.
I created XHON because I wanted a format like JSON, but with comments, graphs, s-expressions and a few more things. Since extending JSON is not possible due to it being standardized and all other formats (like YAML, Hjson, EDN and XML) are either way too damn complicated, use significant whitespace (which I absolutely hate) or have weird limitations like not supporting comments (Why JSON, why?), I decided to invent my own format for my projects that doesn’t have these problems; the result being XHON.
XHON is a superset of JSON and is thus fully backwards compatible to it but at the same time extending it with quite a bunch of features.
To give you a basic idea on whats in store, here is what XHON has on top of JSON:
- Quoteless Keys
- Comments (which can be stacked)
- A more complete numerical type (that supports NaN and Infinity).
- Strings that can go over multiple lines.
- A byte array type for embedding binary data inside a plain text format.
- An actual datetime type loosely based on the Joda-Time library.
- A special ‘unit’ type for numbers to allow things like
200m²
. - A key/value type that allows duplication of keys and empty keys.
- A type for writing paths made of elements instead of just strings.
- A s-expression type ala LISP, making it possible to store expressions w/o strings.
- A graph type for storing undirected/directed graphs in a format similar to TGF.
- Parser function callbacks to allow easy extension and extension by macros.
…and all of this while still keeping the whole thing easely readable by both humans and computers.
Right now there is no parser implemented for XHON, though SHC is being awesome and is working on one!
Following is the link to the 19 page long PDF file that is the specification (hosted on google drive):
The specification is feature frozen, so the only thing left to do is to fix grammatical mistakes and (possibly) logical errors in the definitions.
So, if you happen to read the specification and stumble upon a grammar mistake or a logical error, please tell me!
Thank you and have a nice day!
- Lars Longor K
PS: I’m pretty darn happy that I managed to finish this specification. Yay!