Skip to content

PurpleDoubleD/json-fmt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json-fmt 🛠️

JSON Swiss Army Knife — Format, minify, and convert JSON to .env or YAML from the command line.

Install

npm install -g json-fmt

Usage

# Format JSON (pretty print)
echo '{"name":"test","value":123}' | json-fmt

# Minify JSON
echo '{"name":"test","value":123}' | json-fmt --minify

# Convert JSON to .env
echo '{"name":"test","value":123}' | json-fmt --to-env

# Convert JSON to YAML
echo '{"name":"test","value":123}' | json-fmt --to-yaml

# Custom indent (2 or 4)
echo '{"a":1}' | json-fmt -i 4

Options

Flag Description
-f, --format Format JSON (default)
-m, --minify Minify JSON
--to-env Convert JSON to .env format
--to-yaml Convert JSON to YAML
-i, --indent Indentation (2 or 4)
-h, --help Show help

Examples

From file

json-fmt data.json
json-fmt data.json --minify > data.min.json

Pipe chain

curl -s https://api.example.com/data | json-fmt | jq '.data'

License

MIT

About

JSON Swiss Army Knife - format, minify, convert to env/yaml

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors