Skip to content

copyleftdev/nim-toon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nim-toon

nim-toon is a modular Nim implementation of the TOON (Token-Oriented Object Notation) format.

Status: early public release candidate with fixture-backed conformance coverage.

It provides:

  • encode(JsonNode): string
  • decode(string): JsonNode
  • configurable indentation and delimiter options
  • strict decoding with array-length and indentation checks
  • optional safe dotted-path expansion on decode
  • fixture-backed conformance tests against upstream TOON spec cases

Install

nimble install

If your environment restricts ~/.nimble, set NIMBLE_DIR to a writable directory before running nimble.

Usage

import std/json
import toon

let value = %*{
  "users": [
    {"id": 1, "name": "Ada"},
    {"id": 2, "name": "Bob"},
  ]
}

let text = encode(value)
let decoded = decode(text)

Test Coverage

The repository includes:

Run them with:

nim c -r tests/test_toon.nim
nim c -r tests/test_spec_fixtures.nim

Module layout

Numeric policy

Encoding emits canonical decimal strings without exponent notation. Decoding accepts exponent forms, but values outside Nim's native numeric range are not promoted to arbitrary-precision types; callers that need exact big-number handling should keep those values as strings before encoding.

Publishing Notes

For GitHub publication, the repository already includes:

Contact

Maintainer: copyleftdev <copyleftdev@users.noreply.github.com>

About

Nim implementation of TOON (Token-Oriented Object Notation): compact, human-readable JSON serialization and parsing for AI and LLM prompt workflows.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages