# tinysonic

> a quick syntax for JSON

Latest version **3.1.0** (published 2024-07-16) · MIT license · 0 weekly downloads

## Install

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

## 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 | 3.1.0 |
| Published | 2024-07-16 |
| First published | 2016-08-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 10 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 57 |
| Author | Matteo Collina |
| Maintainers | matteo.collina |
| Keywords | json, jsonic, flat, object |

## Links

- npm: https://www.npmjs.com/package/tinysonic
- Repository: https://github.com/mcollina/tinysonic
- Homepage: https://github.com/mcollina/tinysonic#readme
- Issues: https://github.com/mcollina/tinysonic/issues
- npm.io page: https://npm.io/package/tinysonic

## 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

- 3.1.0 (latest) — 2024-07-16
- 3.0.0 — 2024-07-12
- 2.0.1 — 2021-07-16
- 2.0.0 — 2021-06-09
- 1.3.0 — 2017-09-13
- 1.2.0 — 2017-03-05
- 1.1.1 — 2016-08-19
- 1.1.0 — 2016-08-19
- 1.0.1 — 2016-08-18
- 1.0.0 — 2016-08-18

## README

# tinysonic


A quick syntax for JSON objects. Heavily inspired by
[jsonic](https://github.com/rjrodger/jsonic), but simpler.

## Install

```
$ npm install tinysonic --save
```

## Example

```js
'use strict'

var tinysonic = require('tinysonic')

const encoded = tinysonic.stringify({
    hello: 'world',
    my: {
        world: 'data'
    }
})

console.log('Encoded: ', encoded)
// Encoded: 'hello:world,my:{world:data}'

const decoded = tinysonic.parse(encoded)

console.log('Decoded: ', decoded)
// Decoded: { hello: 'world', my: { world: 'data' } }

```

## API

### tinysonic.parse(string/buffer)
Parses a tinysonic encoded string. Returns `null` if it fails parsing.

### tinysonic.stringify(object)
Stringifies a js object into a tinysonic string. Returns `null` on error.

### tinysonic(string/buffer)
Alternative for `tinysonic.parse()`


## Syntax

The full syntax is:

* each key value pair is separated by `:`
* multiple pairs are separated by `,`
* each key or value are trimmed for spaces
* numbers are parsed as numbers
* null are parsed as `null`
* booleans are parsed as booleans, e.g. `true` and `false`
* you can wrap objects with `{` and `}`

## License

MIT

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