https://github.com/jackspirou/pretty
A CLI tool that automatically identifies and formats JSON or XML.
https://github.com/jackspirou/pretty
Last synced: about 1 month ago
JSON representation
A CLI tool that automatically identifies and formats JSON or XML.
- Host: GitHub
- URL: https://github.com/jackspirou/pretty
- Owner: jackspirou
- License: apache-2.0
- Created: 2016-01-04T20:26:13.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-01-11T19:47:36.000Z (over 10 years ago)
- Last Synced: 2025-07-14T17:48:58.264Z (11 months ago)
- Language: Go
- Homepage:
- Size: 19.5 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pretty [](http://goreportcard.com/report/jackspirou/pretty)
A CLI tool that automatically identifies and formats JSON or XML.
It is written in Go, is simple, and it has no third party dependencies.
- JSON formatting was tested against a 189.8 MB file, no crashing resulted.
- XML formatting was tested against a 71.1 MB file, no crashing resulted.
## Install
### go get
`$ go get -u github.com/jackspirou/pretty`
### releases
You can download a prebuilt binary [here](https://github.com/jackspirou/pretty/releases).
## JSON
Here is an example of a messy `.json` file:
```bash
$ cat messy.json
{"type":"text","$t":"day: Monday, menu: Paninis, baguettes, spaghetti / Chicken curry"}
```
Let's make it pretty:
```bash
$ cat messy.json | pretty
{
"type": "text",
"$t": "day: Monday, menu: Paninis, baguettes, spaghetti / Chicken curry"
}
```
If you wanted to do something other than print the pretty result to the terminal, pipe it to somewhere:
```bash
$ cat messy.json | pretty | somewhere
```
## XML
Here is an example of a messy `.xml` file:
```bash
$ cat messy.xml
C:\temp
```
Let's make it pretty:
```bash
$ cat messy.xml | pretty
C:\temp
%
```
If you wanted to do something other than print the pretty result to the terminal, pipe it to somewhere:
```bash
$ cat messy.xml | pretty | somewhere
```