An open API service indexing awesome lists of open source software.

https://github.com/davidbernal/async-json-parser

Async JSON parser (parse & stringify)
https://github.com/davidbernal/async-json-parser

async json parser

Last synced: about 2 months ago
JSON representation

Async JSON parser (parse & stringify)

Awesome Lists containing this project

README

          

# async-json-parser
Real Async JSON parser (parse & stringify). Without dependencies.

## Example

#### Promises
```
const asyncJson = require('./index.js');

const obj = {hola: "mundo"};
const str = '{"hola":"mundo"}';

const log = x => console.log(x) || x;
const type = x => log(typeof x);

asyncJson.stringify(obj).then(log).then(type);
asyncJson.parse(str).then(log).then(type);

```

#### Async/await
```
const asyncJson = require('./index.js');

const obj = {hola: "mundo"};
const str = '{"hola":"mundo"}';

const log = x => console.log(x) || x;
const type = x => log(typeof x);

async function main(){
const s = await asyncJson.stringify(obj);
log(s) && type(s);

const o = await asyncJson.parse(str);
log(o) && type(o);
}

main();
```