An open API service indexing awesome lists of open source software.

https://github.com/webdeveric/styled-json-console

Custom Node.js Console that styles your JSON output
https://github.com/webdeveric/styled-json-console

ansi console formatting json logging node nodejs

Last synced: 5 months ago
JSON representation

Custom Node.js Console that styles your JSON output

Awesome Lists containing this project

README

          

# `styled-json-console`

Create a custom Node.js [`Console`](https://nodejs.org/api/console.html#new-consoleoptions) that automatically adds colors to [`JSON`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON) strings.

## Install

```shell
pnpm add styled-json-console
```

## Usage

```ts
import { createConsole } from 'styled-json-console';

const myConsole = createConsole({
// Options go here
});

myConsole.log(
JSON.stringify({
message: 'Hello, World!',
now: Date.now(),
}),
);
```

### [Example](./example/index.ts)

Checkout this repo then run this:

```sh
pnpm install
pnpm build
node ./example/index.ts
```