module Hashie::Extensions::StringifyKeys

def stringify_keys

to strings.
Return a new hash with all keys converted
def stringify_keys
  dup.stringify_keys!
end

def stringify_keys!

test # => {'abc' => 'def'}
test.stringify_keys!
test = {:abc => 'def'}
@example

Convert all keys in the hash to strings.
def stringify_keys!
  keys.each do |k|
    stringify_keys_recursively!(self[k])
    self[k.to_s] = delete(k)
  end
  self
end

def stringify_keys_recursively!(object)

hashes and arrays.
Stringify all keys recursively within nested
def stringify_keys_recursively!(object)
  if self.class === object
    object.stringify_keys!
  elsif ::Array === object
    object.each do |i|
      stringify_keys_recursively!(i)
    end
    object
  elsif object.respond_to?(:stringify_keys!)
    object.stringify_keys!
  else
    object
  end
end