Sha256: cc75d1f60465cec99a1d2cc88f8bdfdf36aaa28fc24c95900e070e2690fcbb28
Contents?: true
Size: 756 Bytes
Versions: 5
Compression:
Stored size: 756 Bytes
Contents
# frozen_string_literal: true require 'oj' require 'easy/jsonapi/exceptions/json_parse_error' module JSONAPI module Parser # A wrapper class for OJ parser module JSONParser # Parse JSON string into a ruby hash # @param document [String] The JSON string to parse # @raise [JSONAPI::Exceptions::JSONParseError] def self.parse(document, symbol_keys: true) Oj.load(document, symbol_keys: symbol_keys) rescue Oj::ParseError => e raise JSONAPI::Exceptions::JSONParseError, e.message end # Convert ruby hash into JSON # @param ruby_hash [Hash] THe hash to convert into JSON def self.dump(ruby_hash) Oj.dump(ruby_hash, mode: :compat) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems