TOON-LD Core Library
High-performance serializer/parser for TOON-LD (Token-Oriented Object Notation for Linked Data). Implements the TOON format v3.0 specification with JSON-LD context expansion support.
Overview
TOON-LD is a text serialization format designed to minimize token count while preserving the semantic richness of JSON-LD. It achieves 40-60% token reduction compared to equivalent JSON-LD representations.
Features
- Tabular Arrays: Arrays of objects are serialized as CSV-like tables with a header
- Primitive Arrays: Simple value arrays use compact inline notation
- JSON-LD Context: Full support for URI compaction/expansion via
@context - JSON-LD 1.1 Keywords: Support for all standard JSON-LD keywords
Example
use ;
let json_ld = r#"{
"@context": {"foaf": "http://xmlns.com/foaf/0.1/"},
"http://xmlns.com/foaf/0.1/name": "Alice",
"http://xmlns.com/foaf/0.1/age": 30
}"#;
// Convert JSON-LD to TOON-LD
let toon = jsonld_to_toon.unwrap;
assert!;
// Convert back to JSON-LD
let back = toon_to_jsonld.unwrap;
Modules
- [
context]: JSON-LD context handling for URI compaction/expansion - [
error]: Error types for TOON-LD operations - [
keywords]: JSON-LD keyword constants and utilities - [
parser]: TOON-LD parser implementation - [
serializer]: TOON-LD serializer implementation