Skip to content

Regularize (Prettify) JSON for JS/TS for debugging

License

Notifications You must be signed in to change notification settings

matthewjablack/jsonr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSONR

Regularize (Prettify) JSON from complex JS/TS objects for debugging

Why

Have you ever run console.log in JS on an object an resulted in something that looks like this

{"users": [{"name": "John", "age": undefined, "email": "[email protected]", "attributes": [Array], "info": [Object], "active": true},{"name": "Jane", "age": undefined, "email": "[email protected]", "attributes": [Array], "info": [Object], "active": false}]}

And you go to prettify that json to debug, and you get an error like this

Pretty JSON

This occurs because JSON format doesn't recognize undefined as a valid value. In fact, this is a common problem with logging complex objects to console with Javascript for debugging.

What

jsonr solves this problem, by preprocessing the JSON so you can pass your logging of complex objects in javascript console directly to jsonr and it will colorize and prettify the output.

JSONR

Installation

To install jsonr, you need to have Rust installed on your machine. Then you can build and install jsonr using Cargo:

cargo build --release

cp target/release/jsonr /usr/local/bin/

Command Line Options

  • -h, --help - Print help information.
  • -V, --version - Print version information.

About

Regularize (Prettify) JSON for JS/TS for debugging

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages