lib/easy/jsonapi/parser/document_parser.rb in easy-jsonapi-1.0.1 vs lib/easy/jsonapi/parser/document_parser.rb in easy-jsonapi-1.0.2
- old
+ new
@@ -1,9 +1,9 @@
# frozen_string_literal: true
require 'easy/jsonapi/document'
-require 'oj'
+require 'easy/jsonapi/parser/json_parser'
module JSONAPI
module Parser
# TODO: Only parse valid object members, currenlty parses any included members.
@@ -14,10 +14,10 @@
# @param req_body [String] The supplied JSONAPI document with POST, PATCH, PUT, or DELETE.
# @return [JSONAPI::Document] The parsed JSONAPI document.
# @raise [JSONAPI::Parser::InvalidDocument] if document is invalid.
def self.parse(req_body)
return if req_body.nil?
- document_hash = Oj.load(req_body, symbol_keys: true) # parse json string into hash
+ document_hash = JSONAPI::Parser::JSONParser.parse(req_body) # parse json string into hash
parse_hash(document_hash)
end
# Parse the JSONAPI Request into objects.
# @param document_hash [Hash] The jsonapi-like ruby hash to parse into objects