# tiny

> Smaller, faster drop-ins for js-yaml, yaml, yamljs, @std/yaml, json5 and ini.

```diff [config.ts]
- import yaml from "js-yaml";
- import JSON5 from "json5";
- import ini from "ini";
+ import yaml from "tinyaml/js-yaml";
+ import JSON5 from "tinyjson5";
+ import ini from "tinyini";
```

## One package per format

Each is published on its own, so you install only what you use.

::packages
::

## Next to what they replace

<!-- automd:drop-ins -->

| You use               | Switch to                          |      Size, gzip |       Parses | Stringifies |
| --------------------- | ---------------------------------- | --------------: | -----------: | ----------: |
| js-yaml 4             | `tinyaml/js-yaml`                  | 14.4 → 11.7 KiB |  1.5× faster | 1.6× faster |
| js-yaml 5             | `tinyaml/js-yaml-v5`               | 17.1 → 16.0 KiB |  1.5× faster | 1.8× faster |
| yaml                  | `tinyaml/yaml`                     | 29.9 → 16.8 KiB | 12.6× faster | 2.8× faster |
| yamljs                | `tinyaml/yamljs`                   |   8.8 → 8.0 KiB |  5.0× faster | 1.1× faster |
| @std/yaml             | `tinyaml/std`                      | 11.3 → 10.7 KiB |  2.0× faster | 1.6× faster |
| json5 2.2.3           | `tinyjson5/json5`                  |   7.6 → 3.2 KiB |  7.7× faster | 5.3× faster |
| json5 1.0.2           | `tinyjson5/json5-v1`               |   8.4 → 3.3 KiB |  8.1× faster | 6.4× faster |
| strip-json-comments 3 | `tinyjson5/strip-json-comments`    |   0.8 → 0.5 KiB |  4.1× faster |           — |
| strip-json-comments 2 | `tinyjson5/strip-json-comments-v2` |   0.7 → 0.5 KiB |  4.5× faster |           — |
| strip-json-comments 5 | `tinyjson5/strip-json-comments-v5` |   0.6 → 0.6 KiB |  4.2× faster |           — |
| jsonc-parser 3.3.1    | `tinyjson5/jsonc-parser`           |   6.6 → 5.9 KiB |  1.2× faster |           — |
| comment-json 4.6.2    | `tinyjson5/comment-json`           | 35.7 → 17.5 KiB |  1.6× faster | 1.2× faster |
| jju 1.4.0             | `tinyjson5/jju`                    |   9.8 → 9.6 KiB |  1.2× faster | 1.4× faster |
| ini 7.0.0             | `tinyini`                          |   1.6 → 1.6 KiB |  2.0× faster | 2.9× faster |

Starting fresh with YAML? The root `tinyaml` API is the smallest of all: 7.8 KiB, 1.8× smaller than js-yaml 4 and 3.8× smaller than yaml. It parses 19.3× faster than yaml and stringifies 12.5× faster.

Size is the minified bundle, gzipped. Speed is the median time to parse and stringify each package's large benchmark file. Measured on Apple M4, Node 26.13 (tinyaml, tinyini) and AMD Ryzen 7 255 w/ Radeon 780M Graphics, Node 24.21.0 (tinyjson5).

<!-- /automd -->

## Questions

::accordion
:::accordion-item{label="How close is each package to the library it replaces?"}
Each one runs the original library's own tests and is compared with it on fuzzed inputs: 1 million for tinyjson5, 6 million calls for tinyini, and every yaml-test-suite case plus thousands of edits for tinyaml. Each package's compatibility page lists every known difference: [tinyaml](https://tiny.onmax.me/tinyaml/guide/switching/), [tinyjson5](https://tiny.onmax.me/tinyjson5/compatibility/), [tinyini](https://tiny.onmax.me/tinyini/compatibility/).
:::

:::accordion-item{label="Can I load them with require()?"}
Yes. All three ship ESM only, and Node 22.12 and later load ESM from `require()`. Bundlers handle them too.
:::

:::accordion-item{label="Why are they faster?"}
Each parser reads character codes in one pass and builds JavaScript values directly, without a tokenizer or a syntax tree in between.
:::

:::accordion-item{label="How are the numbers measured?"}
With scripts in the repository that you can rerun. Each package has a page with the commands: [tinyaml](https://tiny.onmax.me/tinyaml/numbers/reproduce/), [tinyjson5](https://tiny.onmax.me/tinyjson5/develop/), [tinyini](https://tiny.onmax.me/tinyini/develop/).
:::
::

## Sitemap

See the full list of pages in [llms.txt](https://tiny.onmax.me/llms.txt).
