Skip to content

Instantly share code, notes, and snippets.

@brendano
Created August 12, 2008 00:20
Show Gist options
  • Save brendano/4973 to your computer and use it in GitHub Desktop.
Save brendano/4973 to your computer and use it in GitHub Desktop.
jsontidy
#!/usr/bin/env ruby
# jsontidy
# POSSIBLE USAGE
# [[Shell]] cat data.json | jsontidy
# [[TextMate]] Cmd-A Cmd-Opt-R jsontidy
# [[Vim] :%!jsontidy
# alternate implementation: python -m simplejson.tool
require 'rubygems'
require 'json'
x = JSON.parse STDIN.read
puts JSON.pretty_generate(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment