{"id":25486631,"url":"https://github.com/creationix/jsonito","last_synced_at":"2026-03-03T12:34:58.554Z","repository":{"id":275858622,"uuid":"927412496","full_name":"creationix/jsonito","owner":"creationix","description":"JSONito - El sobrinito de JSON","archived":false,"fork":false,"pushed_at":"2025-03-08T21:47:41.000Z","size":1535,"stargazers_count":13,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T01:17:35.018Z","etag":null,"topics":["configuration","json","serialization"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/jsonito","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/creationix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-04T22:59:17.000Z","updated_at":"2025-03-31T01:38:31.000Z","dependencies_parsed_at":"2025-03-01T05:32:12.870Z","dependency_job_id":null,"html_url":"https://github.com/creationix/jsonito","commit_stats":null,"previous_names":["creationix/jito"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creationix%2Fjsonito","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creationix%2Fjsonito/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creationix%2Fjsonito/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creationix%2Fjsonito/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/creationix","download_url":"https://codeload.github.com/creationix/jsonito/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247419864,"owners_count":20936015,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["configuration","json","serialization"],"created_at":"2025-02-18T19:21:40.964Z","updated_at":"2026-03-03T12:34:53.509Z","avatar_url":"https://github.com/creationix.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSONito\n\n\u003cimg align=\"right\" style=\"height:14em\" src=\"img/jito-mascot.webp\" alt=\"Little Jito Mascot\"/\u003e\n\n*El sobrinito de JSON*\n\n[![Bun Tests](https://github.com/creationix/jsonito/actions/workflows/test.yaml/badge.svg?event=push)](https://github.com/creationix/jsonito/actions/workflows/test.yaml)\n\nJSONito (or **Jito** for short) is a close relative of the JSON serialization format — think of it as JSON’s little nephew. While JSON was optimized as a subset of JavaScript, striking a balance between machine-readability and human-friendliness, Jito tips the scales a bit more toward the machine. The result? Documents that are typically **50% smaller**!\n\nAdditionally, the character set has been chosen with care to embed seamlessly inside JSON strings, URL query strings, HTTP headers, or anywhere you might want to tuck away a little piece of configuration as text.\n\n## Installation\n\nThis is published to npm as both an ESM and a CJS module, so you can use it with either.\n\n```sh\nnpm i --save jsonito\n```\n\nYou can require it from a node CJS script.\n\n```js\nconst JSONito = require('jsonito')\n// or\nconst { stringify, parse } = require('jsonito')\n```\n\nYou can import it from a node ESM.\n\n```js\nimport * as JSONito from 'jsonito'\n// or\nimport { stringify, parse } from 'jsonito'\n```\n\nOr just copy the [JS file](dist/jsonito.js) to your website and import it using browser native imports.\n\n```html\n\u003cscript type=\"module\"\u003e\n  import * as JSONito from './deps/jsonito.js'\n  // or\n  import { stringify, parse } from './deps/jsonito.js'\n  ...\n\u003c/script\u003e\n```\n\nOr copy the [typescript source](src/jsonito.ts) into your typescript project and import\n\n```ts\nimport * as JSONito from './deps/jsonito.ts'\n// or\nimport { stringify, parse } from './deps/jsonito.ts'\n```\n\n## Usage\n\nIf you want to jump right on in and use this as a JSON replacement, this module exports `stringify` and `parse` functions.\n\n```ts\nconst doc = {\n  name: \"JSONito\",\n  nickname: \"Little Jito\",\n  new: true,\n  magic: 42,\n  colors: [...\"🟥🟧🟨🟩🟦🟪\"],\n}\n\nconst jito: string = JSONito.stringify(doc)\n\nconst decoded: unknown = JSONito.parse(jito)\n```\n\nThe value is printed with no spaces by default for compactness:\n\n```jito\n{name'JSONito'nickname'b~Little Jitonew'!magic'1k.colors'[2~🟥2~🟧2~🟨2~🟩2~🟦2~🟪]}\n```\n\nBut coming soon is an option to pretty-print as well\n\n```jito\n{\n  name' JSONito'\n  nickname' b~Little Jito\n  new' ! \n  magic' 1k.\n  colors' [\n    2~🟥 2~🟧 2~🟨 2~🟩 2~🟦 2~🟪\n  ]\n}\n```\n\n## Performance\n\nSo it's smaller, but by how much you ask?  And does it make parsing slower?\n\nThis [benchmark](src/bench.test.ts) measures encoding and decoding a large collection of [public pokemon information](https://pokeapi.co/api/v2/pokemon/) which ends up being around 1 MiB of typical JSON content.\n\nYou can see the latest results in every [CI commit](https://github.com/creationix/jsonito/actions/runs/13188729510/job/36817001648#step:4:79) to guage performance over time as we optimize this implementation.\n\n| Metric             | JSON     | JSONito    | Relative Comparison                  |\n|--------------------|----------|------------|--------------------------------------|\n| **Parse Time**     | 4.05 ms  | 7.92 ms    | JSONito parse is 1.95x slower        |\n| **Stringify Time** | 1.64 ms  | 29.09 ms   | JSONito stringify is 217.78x slower   |\n| **Encoded Size**   | 1.33 MiB | 239.43 KiB | JSONito encoded is 5.70x **smaller** |\n\n## Gallery of Samples\n\n| JS                                       | JSON                                | JSONito                   | Comment             |\n|------------------------------------------|-------------------------------------|---------------------------|---------------------|\n| `0`                                      | `0`                                 | `.`                       | Integers            |\n| `-1`                                     | `-1`                                | `1.`                      |                     |\n| `1`                                      | `1`                                 | `2.`                      |                     |\n| `-25`                                    | `-25`                               | `N.`                      |                     |\n| `2000`                                   | `2000`                              | `-w.`                     |                     |\n| `-125000`                                | `-125000`                           | `Z2f.`                    |                     |\n| `8654321`                                | `8654321`                           | `121Ly.`                  |                     |\n| `20.24`                                  | `20.24`                             | `3:_g.`                   | Decimal             |\n| `1e100`                                  | `1e100`                             | `38:2.`                   |                     |\n| `-1e-200`                                | `-1e-200`                           | `6f:1.`                   |                     |\n| `Math.PI`                                | `3.141592653589793`                 | `t:mkEokiJF2.`            |                     |\n| `Math.sqrt(3)`                           | `1.7320508075688772`                | `v:1X4t8mn8q8.`           |                     |\n| `true`                                   | `true`                              | `!`                       | True                |\n| `false`                                  | `false`                             | `F!`                      | False               |\n| `null`                                   | `null`                              | `N!`                      | Null                |\n| `''`                                     | `\"\"`                                | `~`                       | Empty String        |\n| `'Banana'`                               | `\"Banana\"`                          | `Banana'`                 | B64 String          |\n| `'Hi, World'`                            | `\"Hi, World\"`                       | `9~Hi, World`             | String              |\n| `'🍌'`                                   | `\"🍌\"`                              | `2~🍌`                    | Unicode String      |\n| `[ 1, 2, 3 ]`                            | `[1,2,3]`                           | `[2.4.6.]`                | Lists               |\n| `[ 100, 100, 100 ]`                      | `[100,100,100]`                     | `38.[***]`                | Lists with Pointers |\n| `{ a: 1, b: 2, c: 3 }`                   | `{\"a\":1,\"b\":2,\"c\":3}`               | `{a'2.b'4.c'6.}`          | Maps                |\n| `[ { name: 'Alice' }, { name: 'Bob' } ]` | `[{\"name\":\"Alice\"},{\"name\":\"Bob\"}]` | `name'[{*Alice'}{*Bob'}]` | Repeated Keys       |\n| `new Map([[1,2],[3,4]])`                 | N/A                                 | `{2.4.6.8.}`              | Non-string Keys     |\n\n## The Syntax\n\nAt its core, Jito's syntax revolves around the `value`. This can encode the same data types as JSON: `string`, `number`, `boolean`, `null`, `map`, and `list`.\n\n![Railroad Diagram for Value](img/syntax-value.png)\n\nJito does away with delimiters like `:` or `,`, and whitespace is entirely insignificant—giving you the freedom to format as you please. And yes, comments are welcome in Jito's house (even if Uncle JSON wouldn’t allow them).\n\n![Railroad Diagram for Comment](img/syntax-comment.png)\n\nContainers are still enclosed by `{`, `}`, `[`, and `]`, just like in JSON. However, everything else is prefixed by a Base64 integer followed by a type tag.\n\n![Railroad Diagram for B64](img/syntax-b64.png)\n\nOne of the key ways Jito reduces encoding size is by allowing repeated values to be written just once and then referenced later. This is achieved by prefixing a value with zero or more other values — each one in the chain can `reference` any previous values.\n\n![Railroad Diagram for Document](img/syntax-document.png)\n\nFor even more extreme size compaction, external dictionaries of predefined values can be employed by the encoder. The encoder must assign an ID to the set, which is then included as a `dictionary` value capable of replacing zero or more repeated values.\n\n![Railroad Diagram for Stream](img/syntax-stream.png)\n\nFinally, while JSON had to be extended with NDJSON to support streaming values, Jito has streaming built right in. Simply insert `;` between documents to delimit them, and feel free to include newlines since they hold no significance in the syntax.\n\n---\n\nHappy encoding with JSONito—the little nephew who’s big on efficiency!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcreationix%2Fjsonito","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcreationix%2Fjsonito","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcreationix%2Fjsonito/lists"}