pretty-clipboard

0.0.29 • Public • Published

pretty-clipboard

Pretty print JSON like objects found in the clipboard to console.

Also dumps JSON found within strings recursively.

Installation

npm install -g pretty-clipboard

Usage

Say you have some JSON-like string in your clipboard among other text

Some text {'foo': "bar", name: null, count: 1234, bool: true, python: None, "Object": { inner: 1, test: 'string'} } more text

You can pretty print it to the console using inspect with

pc

Gives output

output.png

To pretty print a correctly stringified JSON object, use jc instead (no colours)

jc

Bonus

uc will unescape the clipboard contents (e.g. \n to newline, html entities, url encoded characters).

uc

Copy the following text to the clipboard and give it a go

\u2728Hello\u2728
%D1%88%D0%B5%D0%BB%D0%BB%D1%8B
%3Fx%3Dtest\nHello%20World
line1\nline2\nline3\ttabbed
test&test "hey" 'there'

Notes for pc and jc

Repairs common JSON errors like single quotes, missing quotes, trailing commas, missing commas.

Also repairs quoted keys and values e.g. as used in Kibana logs.

Package Sidebar

Install

npm i pretty-clipboard

Weekly Downloads

6

Version

0.0.29

License

ISC

Unpacked Size

25.1 kB

Total Files

18

Last publish

Collaborators

  • qarj