Socket
Socket
Sign inDemoInstall

node-json-color-stringify

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-json-color-stringify

JSON.stringify substitution to colorize output to STDOUT


Version published
Weekly downloads
392
decreased by-48.22%
Maintainers
1
Weekly downloads
 
Created
Source

node-json-color-stringify

Add a colorized version of JSON.stringify to JSON for console (Compatible with Windows and UNIX like systems).

Features

screenshot macOS

node-json-color-stringify offers an alternative method to replace JSON.stringify method by a new one that highlights JSON content for console output.

Install

npm install --save node-json-color-stringify

Usage

Colorized version is available as JSON.colorStringify:

require('node-json-color-stringify');
console.log(JSON.colorStringify({string: 'foo', nullElement: null, bool: false, integer: 42, array: ['Foo', 'bar']}));

Import node-json-color-stringify and use JSON.stringify as usual for non-colorized object output:

require('node-json-color-stringify');
console.log(JSON.stringify({string: 'foo', nullElement: null, bool: false, integer: 42, array: ['Foo', 'bar']}));

Replace array or function are also available:

require('node-json-color-stringify');
console.log(JSON.colorStringify(data, ['nullElement'], 2));
console.log(JSON.colorStringify(data, (key, value) => {
  if (key === 'string') {
    return undefined;
  } else if (value === null) {
    return 0; 
  }
  return value;
}, 2));

Contributing

Contributions welcome; Please submit all pull requests against the master branch. If your pull request contains JavaScript patches or features, you should include relevant unit tests.

Author

René BIGOT

License

  • MIT : http://opensource.org/licenses/MIT

FAQs

Package last updated on 15 May 2017

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc