High Frontier

GRFON (General Recursive Format Object Notation) is a human-readable serialization format, similar in purpose to the older JSON and XML formats.  GRFON (pronounced "griffon"), however, is designed to be easier for humans to read and write, using any simple text editor.

Examples

Let's start with a simple example of a GRFON file containing a couple of key/value pairs, including a list.

name: Bill T. Cat
color: orange
quotes: {
    Ack.
    Thhpt?
    Blech!
}

Structure

A GRFON file is a hierarchy of nodes, which come in two types: value nodes, and collection nodes.

A value node is simply a string, though the string may be interpreted as a number, vector, or whatever by the code that loads it.

A collection node is a series of values, which may or may not be associated with keys.  Keyed values (often referred to as key/value pairs) are represented as a string key, followed by a colon, and the string values.  Unkeyed (plain) values occur as just the value itself.

A collection may contain any number of key/value pairs, and any number of unkeyed values.  However, it is invalid to use the same key twice in one collection, and the order of the key/value pairs is irrelevant (and not maintained).  Unkeyed values are kept in order.

So, a collection can act as a dictionary mapping keys to values, or it can act as a list — or (as is common), it can be both: a collection of keyed values plus a list of plain values.

Except for the "root" level of the GRFON document itself, a collection must always begin with a '{' (open curly brace) and end with a '}' (close curly brace).  Values or key-value pairs in a collection may be separated by either line breaks or semicolons.

Encoding

GROFN files most always be in UTF-8 format.

Learning More

If you need more details, check out the official GRFON wiki, or this blog post.



Copyright (©) 2016 Strout and Sons, LLC   |   Home   |   Download   |   Store