colored-json-stringify
TypeScript icon, indicating that this package has built-in type declarations

1.1.3 • Public • Published

colored-json-stringify

A JSON.stringify replacement that retains colors when logging to the terminal console.

Installation

You can install the package using npm/yarn/pnpm/bun:

npm install colored-json-stringify

Usage

import { coloredJSONStringify } from 'colored-json-stringify';

const obj = { name: "John", age: 30, married: true, children: null };
console.log(coloredJSONStringify(obj));

This will output a colored JSON string in your terminal.

Features

  • Retains colors for different data types when logging to the terminal console
  • Supports numbers, strings, booleans, and null values with distinct colors
  • Supports nested objects and arrays

Typescript

This package is fully written in TypeScript and provides type definitions out of the box. You can use it seamlessly in your TypeScript projects

Testing

This package uses mocha and chai for testing. To run the tests, use the following command:

npm run build
npm test

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any changes.

Bun Compatibility

This package is compatible with Bun. To run the tests with Bun:

bun run test:bun

Acknowledgements

This package uses the chalk library for color handling in the terminal.

Package Sidebar

Install

npm i colored-json-stringify

Weekly Downloads

2

Version

1.1.3

License

MIT

Unpacked Size

9.74 kB

Total Files

9

Last publish

Collaborators

  • brent.hoover