v0.3.0 — now with encode, validate & schema

Data format
built for
LLMs.

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.

$npm install oryx-parser
~42% fewer tokens
# 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 });
42%
avg token reduction
40
tests passing
7
API functions
12kb
package size

Everything you need.
Nothing you don't.

v0.3.0 ships a complete toolkit — parser, encoder, validator, schema checker and CLI all in one 12 kB package.

parse()
Full-featured parser
Tabular arrays, nested objects, @alias compression, pipe strings, inline arrays, null values and scientific notation.
encode()
JSON → ORYX encoder v0.3
Converts any JS object to compact ORYX. Auto-detects uniform arrays for tabular format. Generates @alias blocks for long field names.
validate()
Error messages with caret v0.3
Validate without throwing. Returns line, column and a ^ pointer to the exact error — like TypeScript or Rust.
get()
Dot-path accessor v0.3
get(data, 'users.0.name', fallback) — supports array indices, null-safe traversal and default values.
schema()
Shape validation v0.3
Validate LLM output against an expected shape. Supports nested objects, typed arrays and 'any' wildcards.
$ oryx
CLI tool v0.3
npx oryx parse, encode, validate and roundtrip. Flags for indent, aliases and safe mode.

Simple API surface.

Seven functions. Fully typed. Works in Node.js, Deno, Bun and any modern bundler via ESM.

parse(input, opts?)
string → OryxObject | null
encode(data, opts?)
OryxObject → string
validate(input)
string → ValidationResult
get(data, path, default?)
OryxObject → OryxValue
has(data, path)
OryxObject → boolean
schema(data, shape)
OryxObject → SchemaResult
stringify(data, opts?)
alias for encode()
example
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

Less noise.
More signal.

Every character counts when you're paying per token. ORYX strips the structural overhead JSON was never designed to lose.

JSON148 tokens
{
  "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
    }
  ]
}
ORYX52 tokens
products[3]{id,name,price,inStock}:
  1, Laptop Pro,    1299, true
  2, Wireless Mouse, 49,   true
  3, USB-C Hub,     79,   false
Token savings — tabular data
JSON: 148 tokens64.9% saved → 52 tokens

Write ORYX.
See results instantly.

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.

● Live parsing● Token counter● JSON ↔ ORYXSchema validatorShare snippetsExamples library
Open ORYX Studio ↗or install locally
🔒oryx-studio.neuralcodelab.com
ORYX input
products[]{id,name,price}:
  1, Laptop, 1299
  2, Mouse,  49
  3, Hub,    79

config:
  env: production
  debug: false
JSON output
{
  "products": [
    {"id":1,"name":
      "Laptop","price":1299},
    ...
  ],
  "config": {
    "env":"production",
    "debug":false
  }
}

Up and running
in 60 seconds.

01
Install
npm install oryx-parser
02
Import
import { parse, encode } from 'oryx-parser'
03
Use the CLI
npx oryx parse data.oryx
quickstart.ts
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 });