🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@iridium/async-json-parser

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@iridium/async-json-parser

Async JSON parse and stringify

1.0.0
latest
npm
Version published
Weekly downloads
1
-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

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();

FAQs

Package last updated on 09 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts