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

@saykit/format-json

v0.11.0

Published

JSON file formatter for saykit

Readme

@saykit/format-json

JSON file formatter for SayKit.

Coverage

Writes one JSON catalogue per locale, the de facto format for web i18n (react-intl, FormatJS, i18next, …). Reach for this instead of @saykit/format-po when you want plain JSON bundles with no Gettext tooling.

Install

pnpm add -D @saykit/format-json

Usage

import json from '@saykit/format-json';

// inside a bucket:
formatter: json(),

Each catalogue is a pretty-printed, flat map keyed by the message id (falling back to a stable content hash when a message has no id, the same key the runtime resolves), with the translation as the value:

{
  "greeting": "Hello"
}

ICU MessageFormat strings are stored verbatim as JSON string values, so JSON escaping is handled for you.

Dialects

The plain layout above is just { key: value }, so it drops comments, context, and source references. Pass dialect to keep them using a richer but still standard JSON layout:

  • dialect: 'arb': Application Resource Bundle (Flutter/Dart intl). Strings stay flat; each key's metadata lives in a sibling @key object.
  • dialect: 'webextension': the Chrome/WebExtension messages.json shape, where each key maps to a { message, description } object.
formatter: json({ dialect: 'arb' }),
{
  "@@locale": "fr",
  "greeting": "Bonjour",
  "@greeting": {
    "description": "A friendly hello",
    "x-saykit-context": "formal",
    "x-saykit-references": ["src/app.ts:10"]
  }
}

Both formats carry translator comments in their native description field. Context and source references have no standard slot, so SayKit round-trips them through x-saykit-context / x-saykit-references extension fields, so other tooling reads the description and safely ignores the rest.

Options

  • dialect (default none): 'arb' or 'webextension', see above.
  • includeReferences (default true): include x-saykit-references source references. No effect on the plain layout, which carries no metadata.
  • includeLineNumbers (default true): include line numbers in those references.

[!NOTE] JSON catalogues are keyed by message id, so give your messages explicit ids to get stable, human-readable keys. The plain layout carries no source references, comments, or contexts: it is a lean runtime format.

Documentation

See saykit.js.org/core-concepts/formats.