Skip to content

A CLI tool that automatically identifies and formats JSON or XML.

License

Notifications You must be signed in to change notification settings

jackspirou/pretty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pretty Go Report Card

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.

JSON

Here is an example of a messy .json file:

$ cat messy.json
{"type":"text","$t":"day: Monday, menu: Paninis, baguettes, spaghetti / Chicken curry"}

Let's make it pretty:

$ 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:

$ cat messy.json | pretty | somewhere

XML

Here is an example of a messy .xml file:

$ cat messy.xml
<config><diagnostics><path>C:\temp</path>
<proxy usedefault="true"/></diagnostics></config>

Let's make it pretty:

$ cat messy.xml | pretty
<config>
	<diagnostics>
		<path>C:\temp</path>
		<proxy usedefault="true"></proxy>
	</diagnostics>
</config>%

If you wanted to do something other than print the pretty result to the terminal, pipe it to somewhere:

$ cat messy.xml | pretty | somewhere

About

A CLI tool that automatically identifies and formats JSON or XML.

Resources

License

Stars

Watchers

Forks

Packages

No packages published