toon

A modular Nim implementation of the TOON data format

Pure Nim score 15/100 · tests present · no docs generated

Summary

Latest Version 0.1.0
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-07-21 05:27

Authors

  • copyleftdev <copyleftdev@users.noreply.github.com>

Installation

nimble install toon
choosenim install toon
git clone https://github.com/copyleftdev/nim-toon

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
toon - - - - - - -

Dependencies

Package Version Optional
nim >= 2.2.0 No

Source

Repository https://github.com/copyleftdev/nim-toon
Homepage https://github.com/copyleftdev/nim-toon
Registry Source nimble_official

README

nim-toon

Tip my tokens

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>