module VCR::Cassette::Serializers::JSON
The JSON serializer. Uses `MultiJson` under the covers.
Constants
- ENCODING_ERRORS
@private
Public Instance Methods
deserialize(string)
click to toggle source
Deserializes the given string using `MultiJson`.
@param [String] string the JSON string @return [Hash] the deserialized object
# File lib/vcr/cassette/serializers/json.rb, line 40 def deserialize(string) handle_encoding_errors do MultiJson.decode(string) end end
file_extension()
click to toggle source
The file extension to use for this serializer.
@return [String] “json”
# File lib/vcr/cassette/serializers/json.rb, line 22 def file_extension "json" end
serialize(hash)
click to toggle source
Serializes the given hash using `MultiJson`.
@param [Hash] hash the object to serialize @return [String] the JSON string
# File lib/vcr/cassette/serializers/json.rb, line 30 def serialize(hash) handle_encoding_errors do MultiJson.encode(hash) end end