Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: fdbca7f0f1
Fetching contributors…

Cannot retrieve contributors at this time

111 lines (87 sloc) 2.849 kb


Pretty prints JSON output with even more prettiness, and focus on readability. Also understands things like terminal width, colors, and HTML.

Why another one?

There's plenty of JSON formatters out there, in tons of languages. While none of them are perfect, this one is special because:

  • Left-align key names. Column-align the values.
  • When nested objects or arrays are short and simple, keep them in the same line as the key. If they're longer, or contain further nestings, then make them multiline.
  • Terminal width aware, so that things don't wrap if we can help it.
  • Colorized terminal output optional.
  • TODO: (colored) HTML output, so we don't have to roundtrip through yet another syntax library.


Add this line to your application's Gemfile:

gem 'prissy'

And then execute:

$ bundle

Or install it yourself as:

$ gem install prissy


From the command line

$ cat example_input.json | prissy
  "array":         [
  "false":         false,
  "inline_array":  ["one", "two", "three"],
  "inline_object": {"foo": "bar"},
  "null":          null,
  "number":        42.0,
  "object":        {
    "baz":  "bax",
    "foo":  "bar",
    "more": [1, 2, 3]
  "string":        "a text string",
  "true":          true

$ curl -H "Accept: application/json" | prissy
  "type":         "User",
  "bio":          "",
  "blog":         "",
  "company":      "GitHub",
  "created_at":   "2008-02-11T18:44:09Z",
  "email":        "",
  "followers":    35,
  "following":    1,
  "gravatar_id":  "d587890d0fcf8f45724baa8b1bfe1bf4",
  "hireable":     false,
  "html_url":     "",
  "id":           184,
  "location":     "Boulder, CO",
  "login":        "paul",
  "name":         "Paul Sadauskas",
  "public_gists": 322,
  "public_repos": 82,
  "url":          ""

In Ruby

# The easy way

# With options 120, color: false).prissy(json_or_hash)


prissy output


  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
Jump to Line
Something went wrong with that request. Please try again.