module VCR::Cassette::Serializers::JSON
The JSON
serializer.
Constants
- ENCODING_ERRORS
@private
- SYNTAX_ERRORS
@private
Public Instance Methods
deserialize(string)
click to toggle source
Deserializes the given string using ‘JSON`.
@param [String] string the JSON
string @return [Hash] the deserialized object
# File lib/vcr/cassette/serializers/json.rb, line 44 def deserialize(string) handle_encoding_errors do handle_syntax_errors do ::JSON.parse(string) end 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 26 def file_extension "json" end
serialize(hash)
click to toggle source
Serializes the given hash using ‘JSON`.
@param [Hash] hash the object to serialize @return [String] the JSON
string
# File lib/vcr/cassette/serializers/json.rb, line 34 def serialize(hash) handle_encoding_errors do ::JSON.pretty_generate(hash) end end