Skip to content

Instantly share code, notes, and snippets.

@tenderlove
Forked from jmhodges/avro_lulz.rb
Created April 13, 2010 00:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tenderlove/364192 to your computer and use it in GitHub Desktop.
Save tenderlove/364192 to your computer and use it in GitHub Desktop.
if !defined?(JSON)
require 'yajl'
else
require 'json'
module Yajl
LOOKUP = Hash[%w[null boolean string bytes int long float double].map { |x| [x.inspect, x] }]
def self.dump obj
JSON.dump obj
end
def self.load string
LOOKUP[string] || JSON.load(string)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment