class OxfordDictionary::Deserialize
A small service object that parses a JSON payload into an OpenStruct recursively. The keys of the OpenStruct are in camelCase, not snake_case. This keeps the struct more representative of the JSON in the response.
Public Instance Methods
call(payload)
click to toggle source
Parses a JSON payload into an OpenStruct Nested objects are also parsed into OpenStructs
@param [String] payload a JSON string
@return [OpenStruct] the JSON parsed into OpenStructs recursively
# File lib/oxford_dictionary/deserialize.rb, line 15 def call(payload) JSON.parse(payload, object_class: OpenStruct) end