module Hanami::Utils::Json
JSON wrapper
If you use MultiJson gem this wrapper will use it. Otherwise - JSON std lib.
@since 0.8.0
Constants
- ParserError
@since 0.8.0 @api private
Public Class Methods
generate(object)
click to toggle source
Generate a JSON document from the given object
@param object [Object] any object
@return [String] the result of the dumping process
@since 0.9.1
# File lib/hanami/utils/json.rb, line 76 def self.generate(object) @@engine.generate(object) end
parse(payload)
click to toggle source
Parses the given JSON paylod
@param payload [String] a JSON payload
@return [Object] the result of the loading process
@raise [Hanami::Utils::Json::ParserError] if the paylod is invalid
@since 0.9.1
# File lib/hanami/utils/json.rb, line 65 def self.parse(payload) @@engine.parse(payload) end