Token Reduced Object Notation (TRON) is a data serialization format, extended from JSON, with token efficiency features.
npm install @tron-format/tron

A JavaScript library for converting data to and from the TRON (Token Reduced Object Notation) format.
See full specification for the TRON format at: https://tron-format.github.io/
``bash`
npm i @tron-format/tron
`typescript
import { TRON } from '@tron-format/tron';
const value = { a: 1, b: 2 };
const tron = TRON.stringify(value);
console.log(tron);
// Output:
// class A: a,b
//
// A(1,2)
const parsed = TRON.parse(tron);
console.log(parsed);
// Output:
// { a: 1, b: 2 }
`
In JavaScript, calling JSON.stringify(undefined) returns undefined. However, calling TRON.stringify(undefined) returns 'null' instead. This is intentional to better align with the function's return type (string only) for TypeScript.
Other cases of stringifying undefined are handled the same way as JSON.stringify. For example:
- TRON.stringify([undefined]) returns '[null]' (same behavior as JSON.stringify([undefined]))TRON.stringify({ a: undefined })
- returns '{}' (same behavior as JSON.stringify({ a: undefined })`)
Want to try out TRON with your own JSON data?
Go to https://tron-format.github.io/ and click on "Playground" in the top navigation bar.
Paste it in your data and see TRON's token efficiency compared to other data formats!
MIT License © 2025-PRESENT Tim Huang