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

@toonify/toonify

v1.0.1

Published

Parse TOON format to JSON and JSON to TOON format - A Node.js library

Readme

toonify

Parse TOON format to JSON and JSON to TOON format - A Node.js library.

Installation

npm install @toonify/toonify

Usage

Decode TOON to JSON

import { decode } from "@toonify/toonify";

const toon = `users[2]{id,name,email}:
  1,Alice,[email protected]
  2,Bob,[email protected]`;

const json = decode(toon);
// Returns: {
//   users: [
//     { id: 1, name: 'Alice', email: '[email protected]' },
//     { id: 2, name: 'Bob', email: '[email protected]' }
//   ]
// }

Encode JSON to TOON

import { encode } from "@toonify/toonify";

const json = {
  users: [
    { id: 1, name: "Alice", email: "[email protected]" },
    { id: 2, name: "Bob", email: "[email protected]" },
  ],
};

const toon = encode(json);
// Returns: "users[2]{id,name,email}:\n  1,Alice,[email protected]\n  2,Bob,[email protected]"

TOON Format

TOON is a human-readable data format that uses indentation and special syntax for arrays and objects.

Basic Syntax

  • Objects: Use key: value pairs with indentation for nesting
  • Arrays: Use name[N]{fields}: for tabular arrays or name[N]: for list arrays
  • Delimiters: Comma (default), tab (\t), or pipe (|)

Examples

Simple Object

name: Alice
age: 30
active: true

Nested Object

user:
  name: Alice
  profile:
    email: [email protected]
    role: admin

Tabular Array

users[2]{id,name,email}:
  1,Alice,[email protected]
  2,Bob,[email protected]

List Array

tags[3]:
  javascript
  nodejs
  toon

Mixed Data

config:
  name: My App
  version: 1.0.0
  users[2]{id,name}:
    1,Alice
    2,Bob
  tags[2]:
    frontend
    backend

API

decode(toonString, options?)

Decode a TOON format string to a JavaScript object.

Parameters:

  • toonString (string): TOON formatted string
  • options (object, optional):
    • strict (boolean, default: true): Validate structure strictly
    • expand_paths (string, default: 'off'): Path expansion mode ('off' | 'safe')
    • default_delimiter (string, default: ','): Default delimiter for arrays
    • indent (number): Indent size (auto-detected if not provided)

Returns: JavaScript object or array

encode(data, options?)

Encode a JavaScript object or array to TOON format.

Parameters:

  • data (any): JavaScript object or array to encode
  • options (object, optional):
    • indent (number, default: 2): Indentation size
    • delimiter (string, default: ','): Default delimiter for arrays
    • compact (boolean, default: false): Use compact format

Returns: TOON formatted string

detectIndent(toonString)

Detect the indentation size used in a TOON string.

Parameters:

  • toonString (string): TOON formatted string

Returns: Detected indent size (default 2 if unable to detect)

Features

  • ✅ Parse TOON format to JavaScript objects
  • ✅ Convert JavaScript objects to TOON format
  • ✅ Support for tabular and list arrays
  • ✅ Support for nested objects and arrays
  • ✅ Multiple delimiter support (comma, tab, pipe)
  • ✅ Auto-detection of indentation
  • ✅ Type-safe with JSDoc annotations
  • ✅ ES Modules support

License

MIT