Loading...
Loading...
Loading...
This is currently in-development vaporware.
TON (Tree Object Notation) is a modern data language featuring two dialects: One for programmatic generation of data, and a static subset for safe data interchange.
TON is designed to be a pleasant and compact replacement for both XML and JSON, combining the best qualities of each, while allowing advanced users to programmatically generate large data sets using the full language dialect. At its simplest, TON can be used as a static data format just like XML or JSON, while at its full potential, it can be used to maintain large and complex textual databases at a level of maintainability that such data formats simply cannot achieve.
The original motivation for the creation of TON was the maintenance of the sorts of large data sheets that video games often use to describe things like areas, items, quests, characters, skills, etc. The code dialect should be well-suited to any similar use case. On the other hand, the data dialect can is well-suited as a safe and more compact replacement for XML and JSON, e.g. in networked APIs.
TON is an open standard. This project provides both the specification and the reference implementation in C#.
TON can be installed as a .NET tool in two ways:
To install TON globally, run dotnet tool install ton -g
. This will allow you to run the ton
CLI driver anywhere, assuming you have set up your PATH
appropriately.
To install TON locally in a .NET-based project with a tool manifest, omit the -g
option. This will require you to run dotnet ton
from the project directory.
The ton command line tool is the driver for the reference implementation of TON. It supports evaluation, validation, formatting, and conversion of TON code and data files, and provides a language service for use in text editors.
Option | Description | Default |
---|
Checks that a TON file evaluates successfully.
For a code file, this command runs the script to completion and discards any resulting data. For a data file, this command just checks whether the file parses successfully.
Converts between TON and other data formats.
Valid mode values are:
xml2ton
: Convert an input XML file to a TON data file.
ton2xml
: Convert an input TON code or data file to an XML file.
Note that conversion is done on a best-effort basis; some niche language constructs may not be translated.
Formats a TON code or data file according to the official formatting conventions, or optionally in a minified fashion.
If no input file is given, this command reads from standard output and --fix
will be ignored.
Prints runtime environment information.
Converts a TON code file to a data file.
This command runs the script to completion and outputs the resulting data using the official formatting conventions. If this command is invoked with a data file as input, it effectively functions as a roundabout ton format
.
Runs the TON language service.
Option | Description | Default |
---|
The language service can be used by e.g. the .
Option | Description | Default |
---|
| Enables automatic in-place fixing. |
|
| Enables printing diffs instead of formatted code. |
|
| Enables minification instead of normal formatting. |
|
| Enables standard I/O communication. |
|
| Specifies when to use colored output ( |
|