A JSON.stringify replacement that retains colors when logging to the terminal console.
You can install the package using npm/yarn/pnpm/bun:
npm install colored-json-stringify
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.
- 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
This package is fully written in TypeScript and provides type definitions out of the box. You can use it seamlessly in your TypeScript projects
This package uses mocha and chai for testing. To run the tests, use the following command:
npm run build
npm test
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please open an issue or submit a pull request for any changes.
This package is compatible with Bun. To run the tests with Bun:
bun run test:bun
This package uses the chalk library for color handling in the terminal.