# spa-json

> parse and stringify PipeWire SPA(Simple Plugin API) JSON

Latest version **0.1.0-pre4** (published 2021-11-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install spa-json
pnpm add spa-json
yarn add spa-json
bun add spa-json
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0-pre4 |
| Published | 2021-11-11 |
| First published | 2021-08-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=12.0 |
| Dependencies | 0 |
| Unpacked size | 25.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Huang-Huang Bao |
| Maintainers | eh5 |

## Links

- npm: https://www.npmjs.com/package/spa-json
- Repository: https://github.com/EHfive/spa-json
- npm.io page: https://npm.io/package/spa-json

## Recent versions

- 0.1.0-pre4 (latest) — 2021-11-11
- 0.1.0-pre3 — 2021-08-23
- 0.1.0-pre2 — 2021-08-20
- 0.1.0-pre1 — 2021-08-20
- 0.0.0-pre1 — 2021-08-16
- 0.0.0 — 2021-08-15

## README

# SPA JSON

PipeWire SPA(Simple Plugin API) JSON in JavaScript

## Install

```bash
$ # Yarn
$ yarn add spa-json
$ # or NPM
$ npm i spa-json
```

## Usage

```js
import { parse, stringify } from 'spa-json'

const obj = parse(`
context.properties = {
  core.daemon = true
  core.name = pipewire-0
  default.clock.rate = 48000
  default.clock.allowed-rates = [
    44100 48000 96000
  ]
}

context.modules = [
  # ...
]

# ...
`)

const text = stringify(obj)

// import assert from 'assert'
// assert.deepEqual(parse(text), obj)
```

The api is basically the same as [`JSON.parse()`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse)
and [`JSON.stringify()`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify)
except we have a `noWrap` as the 4th parameter of `stringify()` by which strips top-level wrapper `{` `}`.

For detailed documentation, see [type definitions](lib/index.d.ts).

For example usage, see [test/parse.js](test/parse.js) and [test/stringify.js](test/stringify.js).

## TODO

- [x] implement `stringify()`
- [ ] maybe add AST support for better config manipulating

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