Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

json-colorizer

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-colorizer

A library to format JSON with colors for display in the console

  • 2.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
497K
decreased by-33.22%
Maintainers
1
Weekly downloads
 
Created

What is json-colorizer?

The json-colorizer npm package is a tool that allows you to colorize JSON strings for better readability in the terminal. It helps in debugging and logging by making JSON data more visually appealing and easier to understand.

What are json-colorizer's main functionalities?

Basic Colorization

This feature allows you to colorize a JSON string with default settings. The output will be a colorized version of the JSON string, making it easier to read in the terminal.

const colorize = require('json-colorizer');
const jsonString = '{"name": "John", "age": 30, "city": "New York"}';
console.log(colorize(jsonString));

Custom Colorization

This feature allows you to customize the colors used for different parts of the JSON string. In this example, string keys are colored cyan and string literals are colored magenta.

const colorize = require('json-colorizer');
const jsonString = '{"name": "John", "age": 30, "city": "New York"}';
const options = { colors: { STRING_KEY: 'cyan', STRING_LITERAL: 'magenta' } };
console.log(colorize(jsonString, options));

Pretty Print with Colorization

This feature allows you to pretty-print the JSON string with colorization. The output will be a well-formatted and colorized JSON string, making it even more readable.

const colorize = require('json-colorizer');
const jsonString = '{"name": "John", "age": 30, "city": "New York"}';
const options = { pretty: true };
console.log(colorize(jsonString, options));

Other packages similar to json-colorizer

Keywords

FAQs

Package last updated on 01 May 2019

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