Skip to content

Instantly share code, notes, and snippets.

@TimLang
Created February 13, 2014 07:31
Show Gist options
  • Save TimLang/8971219 to your computer and use it in GitHub Desktop.
Save TimLang/8971219 to your computer and use it in GitHub Desktop.
serialize object to json without escaping
require 'active_support/all'
class Object
def to_json_without_escape
self.to_json.gsub(/\\u([0-9a-z]{4})/){|s| [$1.to_i(16)].pack("U")}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment