ORYX cuts token usage by 30–60% versus JSON, while staying human-readable. Parse, encode, validate and access structured data — designed from the ground up for AI pipelines.
# 88 tokens vs 148 in JSON @alias{firstName: fn, lastName: ln} users[3]{id,fn,ln,role}: 1, Alice, Smith, admin 2, Bob, Jones, user 3, Carol, Lee, editor config: host: localhost port: 3000 active: true secret: null
{ "users": [ { "id": 1, "firstName": "Alice", "lastName": "Smith", "role": "admin" }, { "id": 2, "firstName": "Bob", "lastName": "Jones", "role": "user" }, { "id": 3, "firstName": "Carol", "lastName": "Lee", "role": "editor" } ], "config": { "host": "localhost", "port": 3000, "active": true, "secret": null } }
import { parse, encode, get, schema } from 'oryx-parser'; // Parse ORYX → JSON const data = parse(oryxString); // Access nested values get(data, 'users.0.firstName'); // → "Alice" // Validate shape schema(data, { users: [{ id: 'number', firstName: 'string' }], }); // Encode JSON → ORYX const oryx = encode(data, { aliases: true });
v0.3.0 ships a complete toolkit — parser, encoder, validator, schema checker and CLI all in one 12 kB package.
^ pointer to the exact error — like TypeScript or Rust.get(data, 'users.0.name', fallback) — supports array indices, null-safe traversal and default values.'any' wildcards.npx oryx parse, encode, validate and roundtrip. Flags for indent, aliases and safe mode.Seven functions. Fully typed. Works in Node.js, Deno, Bun and any modern bundler via ESM.
import { parse } from 'oryx-parser'; // throws OryxError on bad input const data = parse(` users[2]{id,name}: 1, Alice 2, Bob `); // safe mode — returns null instead const safe = parse(untrusted, { safe: true });
import { encode } from 'oryx-parser'; const oryx = encode({ users: [ { id: 1, name: 'Alice' }, { id: 2, name: 'Bob' }, ], }, { indent: 2, tabular: true, aliases: false, }); // → users[2]{id,name}: 1, Alice 2, Bob
import { validate } from 'oryx-parser'; const result = validate('host [bad'); // { // valid: false, // error: "[ORYX] Expected array size or ] // host [bad // ^", // line: 1, column: 7 // }
import { get } from 'oryx-parser'; const data = parse(` users[]{id,name}: 1, Alice `); get(data, 'users.0.name'); // "Alice" get(data, 'users.5.name', '?'); // "?" get(data, 'missing'); // null
import { has } from 'oryx-parser'; const data = parse('key: value nullKey: null'); has(data, 'key'); // true has(data, 'nullKey'); // true (null exists) has(data, 'missing'); // false
import { schema } from 'oryx-parser'; const result = schema(data, { users: [{ id: 'number', name: 'string', role: 'any', }], }); // { valid: true, errors: [] }
import { stringify } from 'oryx-parser'; // Same as encode() — familiar name // for JSON.stringify() users const out = stringify({ host: 'localhost', port: 3000, }); // → host: localhost port: 3000
Every character counts when you're paying per token. ORYX strips the structural overhead JSON was never designed to lose.
{ "products": [ { "id": 1, "name": "Laptop Pro", "price": 1299, "inStock": true }, { "id": 2, "name": "Wireless Mouse", "price": 49, "inStock": true }, { "id": 3, "name": "USB-C Hub", "price": 79, "inStock": false } ] }
products[3]{id,name,price,inStock}: 1, Laptop Pro, 1299, true 2, Wireless Mouse, 49, true 3, USB-C Hub, 79, false
ORYX Studio is an interactive playground where you can write ORYX format, parse it to JSON, encode objects back, and measure token savings — all in the browser. No install needed.
products[]{id,name,price}: 1, Laptop, 1299 2, Mouse, 49 3, Hub, 79 config: env: production debug: false
{ "products": [ {"id":1,"name": "Laptop","price":1299}, ... ], "config": { "env":"production", "debug":false } }
import { parse, encode, validate, get, schema } from 'oryx-parser'; const src = ` products[]{id,name,price}: 1, Laptop, 1299 2, Mouse, 49 `; // 1. Validate before parsing const { valid } = validate(src); // 2. Parse const data = parse(src)!; // 3. Access get(data, 'products.0.name'); // "Laptop" // 4. Validate shape schema(data, { products: [{ price: 'number' }], }); // 5. Re-encode with aliases encode(data, { aliases: true });