Skip to content

A CLI app written in Rust to pretty-print JSON

Notifications You must be signed in to change notification settings

binjamil/jsonfmt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jsonfmt

jsonfmt is a simple CLI app written in Rust that pretty-prints JSON to stdout.

Installation

To install jsonfmt, you first need to install Rust.

git clone https://github.com/binjamil/jsonfmt.git 
cd jsonfmt
cargo install --path .

Usage

I usually use jsonfmt to pretty print the output from a cURL request. For example

➜ curl https://dummyjson.com/products/1
{"id":1,"title":"iPhone 9","description":"An apple mobile which is nothing like apple","price":549,"discountPercentage":12.96,"rating":4.69,"stock":94,"brand":"Apple","category":"smartphones","thumbnail":"https://dummyjson.com/image/i/products/1/thumbnail.jpg","images":["https://dummyjson.com/image/i/products/1/1.jpg","https://dummyjson.com/image/i/products/1/2.jpg","https://dummyjson.com/image/i/products/1/3.jpg","https://dummyjson.com/image/i/products/1/4.jpg","https://dummyjson.com/image/i/products/1/thumbnail.jpg"]}

Using jsonfmt can format output JSON to a more human-readable form

➜ curl https://dummyjson.com/products/1 | jsonfmt
{
  "id": 1,
  "title": "iPhone 9",
  "description": "An apple mobile which is nothing like apple",
  "price": 549,
  "discountPercentage": 12.96,
  "rating": 4.69,
  "stock": 94,
  "brand": "Apple",
  "category": "smartphones",
  "thumbnail": "https://dummyjson.com/image/i/products/1/thumbnail.jpg",
  "images": [
    "https://dummyjson.com/image/i/products/1/1.jpg",
    "https://dummyjson.com/image/i/products/1/2.jpg",
    "https://dummyjson.com/image/i/products/1/3.jpg",
    "https://dummyjson.com/image/i/products/1/4.jpg",
    "https://dummyjson.com/image/i/products/1/thumbnail.jpg"
  ]
}

About

A CLI app written in Rust to pretty-print JSON

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages