module Fog::JSON

Public Class Methods

decode(obj) click to toggle source
# File lib/fog/core/json.rb, line 35
def self.decode(obj)
  MultiJson.load(obj)
end
encode(obj) click to toggle source
# File lib/fog/core/json.rb, line 25
def self.encode(obj)
  MultiJson.dump(obj)
end
sanitize(data) click to toggle source
# File lib/fog/core/json.rb, line 6
def self.sanitize(data)
  case data
  when Array
    data.map {|datum| sanitize(datum)}
  when Hash
    for key, value in data
      data[key] = sanitize(value)
    end
  when ::Time
    data.strftime("%Y-%m-%dT%H:%M:%SZ")
  else
    data
  end
end