#!/usr/bin/env ruby require "yajl" require "pygments.rb" def parse_json(input) parsed_input = Yajl::Parser.parse(input) json = Yajl::Encoder.encode(parsed_input, :pretty => true) puts Pygments.highlight(json, :formatter => 'terminal', :lexer => 'javascript') exit 0 rescue Yajl::ParseError puts input exit 1 end begin lines = ARGF.readlines.join parse_json lines end