Sha256: 80ee9172e1aeba4ea74f1d9d46a940605bd0abf789b98f75215f42ea731b297c

Contents?: true

Size: 428 Bytes

Versions: 1

Compression:

Stored size: 428 Bytes

Contents

#!/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', :options => {:encoding => 'utf-8'})
  exit 0
  rescue Yajl::ParseError
    puts input
    exit 1
end

begin
  lines = ARGF.readlines.join
  parse_json lines
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
colorful_json-0.9.2 bin/cjson