Introducing NestedText 3.0, a nice alternative to JSON, YAML, TOML
NestedText is a new file format for holding data that is to be entered, edited,
or viewed by people. It allows data to be organized into a nested collection of
dictionaries, lists, and strings without the need for quoting or escaping. In
this way it is similar to JSON and YAML, but without the complexity and risk of
YAML and without the syntactic clutter of JSON. NestedText is both simple and
natural. Only a small number of concepts and rules must be kept in mind when
creating it. It is easily created, modified, or viewed with a text editor and
easily understood and used by both programmers and non-programmers.
NestedText is convenient for configuration files, address books, account
information and the like. Here is an example of the first entry from a file
that
contains an address book:
# Contact information for our officers
president:
name: Katheryn McDaniel
address:
> 138 Almond Street
> Topeka, Kansas 20697
phone:
cell: 1-210-555-5297
home: 1-210-555-8470
# Katheryn prefers that we always call her on her cell phone.
email: [email protected]
additional roles:
- board member
- new membership task force
- accounting task force
The format holds dictionaries (ordered collections of name/value pairs), lists
(ordered collections of values) and strings (text) organized hierarchically to
any depth. Indentation is used to indicate the hierarchy of the data, and
a simple natural syntax is used to distinguish the types of data in a simple
and
intuitive manner. Specifically, lines that begin with a word or words followed
by a colon are dictionary items; a dash introduces list items, and a leading
greater-than symbol signifies a line in a multiline string. Dictionaries and
lists are used for nesting; the leaf values are always strings. However,
*NestedText* pairs nicely with *voluptuous* to add data validation and
transformation.
Currently there is a Python implementation and a language independent test
suite.
Documentation: https://nestedtext.org
Install: pip install nestedtext
Support: https://github.com/KenKundert/nestedtext/issues
Give it a try.
-Ken
_______________________________________________
Python-announce-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Member address: [email protected]