Class: Nestful::Formats::JSONFormat

Inherits:
Format
  • Object
show all
Defined in:
lib/nestful/formats/json_format.rb

Instance Method Summary collapse

Instance Method Details

#decode(json) ⇒ Object



18
19
20
# File 'lib/nestful/formats/json_format.rb', line 18

def decode(json)
  JSON.parse(json)
end

#encode(hash, options = nil) ⇒ Object



14
15
16
# File 'lib/nestful/formats/json_format.rb', line 14

def encode(hash, options = nil)
  hash.to_json(options)
end

#mime_typeObject



10
11
12
# File 'lib/nestful/formats/json_format.rb', line 10

def mime_type
  'application/json'
end