A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/streamich/pojo-dump below:

streamich/pojo-dump: Print JSON (or any POJO) to a nicely formatted human-readable text

Prints a JSON structure (or any POJO) to the console. Can print to a single line or to a tree structure.

Install the package using NPM or Yarn:

npm install pojo-dump
# or
yarn add pojo-dump

The library provides the following exports:

Print to a single line:

import { toLine } from 'pojo-dump';

const data = [null, true, false, 123, 0.1, 'as\ndf', [1, 2, 3], { foo: 'bar' }];
console.log(toLine(data));
// [ !n, !t, !f, 123, .1, "as" ⏎ "df", [ 1, 2, 3 ], { foo = "bar" } ]

Print to a multi-line tree layout:

import { toTree } from 'pojo-dump';

const data = { foo: 'bar', nested: [1, 2, { key: 'value' }] };
console.log(toTree(data));

/*
Output:

├─ foo = "bar"
└─ nested
   ├─ [0]: 1
   ├─ [1]: 2
   └─ [2]
      └─ key = "value"
*/

Apache 2.0


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4