Sha256: cd960cc0b29226f6f1ca9576500c8345af7387472b9966633d726aaaf3ccf335
Contents?: true
Size: 717 Bytes
Versions: 3
Compression:
Stored size: 717 Bytes
Contents
# frozen_string_literal: true module Basquiat # A simple MultiJson wrapper to protect against eventual API changes. module Json # Serializes an Object into a JSON # @see MultiJson.dump # @param object [Object] object to be serialized # @return [String] JSON representation of the object def self.encode(object) MultiJson.dump(object) end # De-serializes a JSON into a Hash # @see MultiJson.load # @param object [Object] object to be de-serialized # @return [Hash] Hash representing the JSON. The keys are symbolized by default def self.decode(object) MultiJson.load(object, symbolize_keys: true) rescue MultiJson::ParseError {} end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
basquiat-1.3.2 | lib/basquiat/support/json.rb |
basquiat-1.3.1 | lib/basquiat/support/json.rb |
basquiat-1.3.0 | lib/basquiat/support/json.rb |