npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ison-ts

v1.0.1

Published

ISON (Interchange Simple Object Notation) parser for TypeScript/JavaScript

Readme

ison-ts

npm version TypeScript License: MIT Tests

A TypeScript implementation of the ISON (Interchange Simple Object Notation) parser.

ISON is a minimal, LLM-friendly data serialization format optimized for:

  • Graph databases
  • Multi-agent systems
  • RAG pipelines
  • Token-efficient AI/ML workflows

Features

  • Full TypeScript Support: Complete type definitions
  • Zero Dependencies: No external runtime dependencies
  • Full ISON Support: Tables, objects, references, type annotations
  • ISONL Streaming: Line-based format for large datasets
  • JSON Export: Convert ISON to JSON
  • Browser & Node.js: Works in both environments

Installation

npm install ison-ts
# or
yarn add ison-ts
# or
pnpm add ison-ts

Quick Start

import { parse, dumps, fromDict, Reference } from 'ison-ts';

// Parse ISON text
const isonText = `
table.users
id:int name:string email active:bool
1 Alice [email protected] true
2 Bob [email protected] false
`;

const doc = parse(isonText);

// Access blocks
const users = doc.getBlock('users');
console.log(`Users: ${users.size()}`);

// Access values with type checking
for (const row of users.rows) {
    console.log(`${row.id}: ${row.name} (${row.active ? 'active' : 'inactive'})`);
}

// Convert to JSON
const json = doc.toJson();

// Serialize back to ISON
const isonOutput = dumps(doc);

API Reference

Parsing

import { parse, loads, loadsIsonl } from 'ison-ts';

// Parse from string
const doc = parse(text);
const doc = loads(text);  // Alias

// Parse ISONL
const doc = loadsIsonl(isonlText);

Serialization

import { dumps, dumpsIsonl } from 'ison-ts';

// To ISON string
const ison = dumps(doc);
const ison = dumps(doc, false);  // No column alignment

// To ISONL
const isonl = dumpsIsonl(doc);

// To JSON
const json = doc.toJson();
const json = doc.toJson(4);  // Custom indent

Creating Documents

import { fromDict, Document, Block } from 'ison-ts';

// From plain object
const data = {
    products: [
        { id: 1, name: 'Widget', price: 29.99 },
        { id: 2, name: 'Gadget', price: 49.99 }
    ]
};
const doc = fromDict(data);

// Programmatically
const doc = new Document();
const block = new Block('table', 'users');
block.fields = ['id', 'name'];
block.fieldInfo = [
    { name: 'id', type: 'int', isComputed: false },
    { name: 'name', type: 'string', isComputed: false }
];
block.rows = [
    { id: 1, name: 'Alice' },
    { id: 2, name: 'Bob' }
];
doc.blocks.push(block);

Document Access

const doc = parse(text);

// Check if block exists
if (doc.has('users')) {
    const users = doc.getBlock('users');

    // Block properties
    users.kind;       // 'table', 'object', 'meta'
    users.name;       // 'users'
    users.size();     // Row count
    users.fields;     // Field names

    // Access rows
    for (const row of users.rows) {
        // Row is Record<string, Value>
    }
}

Type Checking

import {
    isNull, isBool, isInt, isFloat, isString, isReference,
    Value, Reference
} from 'ison-ts';

const value: Value = row.someField;

if (isNull(value)) { /* null */ }
if (isBool(value)) { /* boolean */ }
if (isInt(value)) { /* integer */ }
if (isFloat(value)) { /* number */ }
if (isString(value)) { /* string */ }
if (isReference(value)) {
    const ref: Reference = value;
    ref.id;              // Referenced ID
    ref.type;            // Optional type/namespace
    ref.isRelationship(); // true if UPPERCASE type
    ref.toIson();        // ':type:id' or ':id'
}

References

import { Reference } from 'ison-ts';

// Simple reference :42
const ref = new Reference('42');
ref.toIson();  // ':42'

// Namespaced reference :user:101
const ref = new Reference('101', 'user');
ref.getNamespace();  // 'user'
ref.isRelationship(); // false

// Relationship reference :MEMBER_OF:10
const ref = new Reference('10', 'MEMBER_OF');
ref.isRelationship();     // true
ref.relationshipType();   // 'MEMBER_OF'

Field Info

// Access type annotations
for (const fi of block.fieldInfo) {
    fi.name;        // Field name
    fi.type;        // Optional type annotation
    fi.isComputed;  // true if type is 'computed'
}

// Query field types
const type = block.getFieldType('price');  // string | undefined
const computed = block.getComputedFields(); // string[]

ISONL Format

ISONL is a line-based streaming format where each line is self-contained:

table.users|id name email|1 Alice [email protected]
table.users|id name email|2 Bob [email protected]
import { isonToIsonl, isonlToIson } from 'ison-ts';

// Convert between formats
const isonl = isonToIsonl(isonText);
const ison = isonlToIson(isonlText);

Usage with LLMs

OpenAI Integration

import OpenAI from 'openai';
import { fromDict, dumps } from 'ison-ts';

const openai = new OpenAI();

async function queryWithContext(question: string, contextData: object) {
    const isonContext = dumps(fromDict(contextData));

    const response = await openai.chat.completions.create({
        model: 'gpt-4',
        messages: [{
            role: 'user',
            content: `Context:\n${isonContext}\n\nQuestion: ${question}`
        }]
    });

    return response.choices[0].message.content;
}

Anthropic Claude Integration

import Anthropic from '@anthropic-ai/sdk';
import { fromDict, dumps } from 'ison-ts';

const anthropic = new Anthropic();

async function queryWithContext(question: string, contextData: object) {
    const isonContext = dumps(fromDict(contextData));

    const message = await anthropic.messages.create({
        model: 'claude-3-5-sonnet-20241022',
        max_tokens: 1024,
        messages: [{
            role: 'user',
            content: `Context:\n${isonContext}\n\nQuestion: ${question}`
        }]
    });

    return message.content[0].text;
}

ISON Format Quick Reference

# Comment

table.users                    # Block header: kind.name
id:int name:string active:bool # Field definitions with optional types
1 Alice true                   # Data rows
2 "Bob Smith" false           # Quoted strings for spaces
3 ~ null                       # null values (~ or null)

table.orders
id user_id product
1 :1 Widget                    # :1 = reference to id 1
2 :user:42 Gadget             # :user:42 = namespaced reference
3 :MEMBER_OF:10 Thing          # :MEMBER_OF:10 = relationship reference

object.config                  # Single-row object block
key value
debug true
---                            # Summary separator
Total 100                      # Summary row

Test Results

All tests passing:

 ✓ src/index.test.ts (23 tests)

 Test Files  1 passed (1)
      Tests  23 passed (23)

Test coverage includes:

  • Basic parsing and serialization
  • Type annotations and inference
  • References (simple, namespaced, relationship)
  • ISONL streaming format
  • JSON conversion
  • Error handling

Run tests with:

npm test

Links

License

MIT License