Sha256: 26dd94ab69f032d1533c2fd28d989340818ecb8205ababbac55d943d32cfee67
Contents?: true
Size: 611 Bytes
Versions: 1
Compression:
Stored size: 611 Bytes
Contents
require 'json' module OxfordDictionary # 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. class Deserialize # 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 def call(payload) JSON.parse(payload, object_class: OpenStruct) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
oxford_dictionary-3.0.0 | lib/oxford_dictionary/deserialize.rb |