Expand description
A Rust library and CLI tool for TJSON — a readable, round-trip-safe alternative syntax for JSON.
§Quick start
// Deserialize TJSON directly into any serde type
#[derive(serde::Serialize, serde::Deserialize, PartialEq, Debug)]
struct Person { name: String, age: u32 }
let p: Person = tjson::from_str(" name: Alice age:30").unwrap();
// Serialize any serde type to TJSON
let s = tjson::to_string(&p).unwrap();§Features
serde_json(default) — enablesFrom<serde_json::Value>forValueandFrom<Value>forserde_json::Value. Disable if you don’t use serde_json directly and want to avoid pulling itsarbitrary_precisionfeature into your build.
Structs§
- Entry
- A single key-value entry in a TJSON object.
- Invalid
Number - Error returned when a value is not a finite, valid JSON number.
- Number
- A JSON number value, stored as its original string representation.
- Parse
Error - A parse error with source location and optional source line context.
- Render
Options - Options controlling how TJSON is rendered. Use
RenderOptions::defaultfor sensible defaults, orRenderOptions::canonicalfor a compact, diff-friendly format. All fields are set via builder methods.
Enums§
- Bare
Style - Controls whether bare (unquoted) strings and keys are preferred.
- Error
- The error type for all TJSON operations.
- Fold
Style - Controls how long strings are folded across lines using
/continuation markers. - Indent
Glyph Marker Style - Controls how the
/<opening glyph of an indent-offset block is placed. - Indent
Glyph Style - Controls when
/<//>indent-offset glyphs are emitted to push content to visual indent 0. - Multiline
Style - Controls which multiline string format is preferred when rendering strings with newlines.
- String
Array Style - Controls how arrays of short strings are packed onto a single line.
- Table
Unindent Style - Controls how tables are horizontally repositioned using
/< />indent-offset glyphs. - Value
- A parsed TJSON value. Mirrors the JSON type system with the same six variants.
Constants§
Functions§
- from_
str - Parse a TJSON string and deserialize it into
Tusing serde. - to_
string - Serialize
valueto a TJSON string using default options. - to_
string_ with - Serialize
valueto a TJSON string using the given options.