async-json-parser
Advanced tools
Comparing version 0.0.3 to 0.0.4
{ | ||
"name": "async-json-parser", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.mjs", |
# Async JSON parser | ||
## parse, stringify | ||
## parse | ||
```js | ||
import fs from 'fs'; | ||
import { parse, stringify } from 'async-json-parser'; | ||
import { parse } from 'async-json-parser'; | ||
import request from 'request'; | ||
@@ -22,5 +21,3 @@ | ||
const data = await get(URL); | ||
const res = await parse(data); | ||
const str = await stringify(json); | ||
fs.writeFileSync('data.json', str); | ||
const result = await parse(data); | ||
})(); | ||
@@ -42,1 +39,29 @@ ``` | ||
## parse stream | ||
```js | ||
import fs from 'fs'; | ||
import {parse} from 'async-json-parser'; | ||
import json from './test.json'; | ||
(async () => { | ||
const stream = fs.createReadStream('test.json'); | ||
const res = await parse(stream); | ||
console.log(+res['a1'][0].address.geo.lat === -37.3159); | ||
console.log(res['a457'][2].address.suite === 'Suite 847'); | ||
})(); | ||
``` | ||
## stringify | ||
```js | ||
import fs from 'fs'; | ||
import {stringify} from 'async-json-parser'; | ||
import json from './test.json'; | ||
(async () => { | ||
const data = await stringify(json); | ||
fs.writeFileSync('data.json', data); | ||
})(); | ||
``` | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
495982
8
11270
66