# jsoncram

> Crams json into a smaller footprint and unpacks it.

Latest version **2.0.3** (published 2020-03-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install jsoncram
pnpm add jsoncram
yarn add jsoncram
bun add jsoncram
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.3 |
| Published | 2020-03-23 |
| First published | 2019-01-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 27.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Sem Postma |
| Maintainers | afirus |
| Keywords | json, javascript, compress, pack, cram |

## Links

- npm: https://www.npmjs.com/package/jsoncram
- Repository: https://github.com/LesterGallagher/jsoncram
- Issues: https://github.com/LesterGallagher/jsoncram/issues
- npm.io page: https://npm.io/package/jsoncram

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 2.0.3 (latest) — 2020-03-23
- 2.0.2 — 2020-01-22
- 1.0.2 — 2019-01-03
- 1.0.1 — 2019-01-03
- 1.0.0 — 2019-01-03

## README

<div align="center">
  <a href="https://www.json.org">
    <img width="200" height="200" vspace="" hspace="25"
      src="https://worldvectorlogo.com/logos/json.svg">
  </a>
</div>

# jsoncram

Crams json into a smaller footprint and unpacks it.

[![GitHub license](https://img.shields.io/github/license/sempostma/jsoncram.svg)](https://github.com/LesterGallagher/jsoncram/blob/master/LICENSE)
[![GitHub issues](https://img.shields.io/github/issues/sempostma/jsoncram.svg)](https://github.com/LesterGallagher/jsoncram/issues)
[![Twitter](https://img.shields.io/twitter/url/https/www.npmjs.com/package/jsoncram.svg?style=social)](https://twitter.com/intent/tweet?text=Wow:&url=https%3A%2F%2Fwww.npmjs.com%2Fpackage%2Fjsoncram)

## Install

```bash
npm i -D jsoncram
```

## Usage

```javascript
const { compress, decompress } = require('jsoncram');

const json = {
    name: 'Sem Postma',
    age: 21
};

const schema = {
    type: "object",
    required: [
        "name",
        "age"
    ],
    properties: {
        name: {
            type: "string"
        },
        age: {
            type: "number"
        }
    }
};

const compressed = compress(json, schema);
const decompressed = decompress(compressed, schema);

if (
    json.name === decompressed.name
    && json.age === decompressed.age
) {
    console.log('Yeeeeey');
}

```

---
_Source: https://npm.io/package/jsoncram · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
