https://github.com/purpledoubled/json-fmt
JSON Swiss Army Knife - format, minify, convert to env/yaml
https://github.com/purpledoubled/json-fmt
cli converter devtools formatter json typescript yaml
Last synced: 3 months ago
JSON representation
JSON Swiss Army Knife - format, minify, convert to env/yaml
- Host: GitHub
- URL: https://github.com/purpledoubled/json-fmt
- Owner: PurpleDoubleD
- License: mit
- Created: 2026-02-28T20:05:52.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2026-02-28T20:06:21.000Z (4 months ago)
- Last Synced: 2026-03-01T19:17:36.533Z (4 months ago)
- Topics: cli, converter, devtools, formatter, json, typescript, yaml
- Language: JavaScript
- Size: 5.12 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# json-fmt 🛠️
**JSON Swiss Army Knife** — Format, minify, and convert JSON to .env or YAML from the command line.
## Install
```bash
npm install -g json-fmt
```
## Usage
```bash
# 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
```bash
json-fmt data.json
json-fmt data.json --minify > data.min.json
```
### Pipe chain
```bash
curl -s https://api.example.com/data | json-fmt | jq '.data'
```
## License
MIT