module Aws::Json::OjEngine

Constants

DUMP_OPTIONS

@api private

LOAD_OPTIONS

@api private

PARSE_ERRORS

@api private

Public Class Methods

dump(value) click to toggle source
# File lib/aws-sdk-core/json/oj_engine.rb, line 25
def dump(value)
  Oj.dump(value, DUMP_OPTIONS)
end
load(json) click to toggle source
# File lib/aws-sdk-core/json/oj_engine.rb, line 19
def load(json)
  Oj.load(json, LOAD_OPTIONS)
rescue *PARSE_ERRORS => e
  raise ParseError.new(e)
end

Private Class Methods

detect_oj_parse_errors() click to toggle source

Oj before 1.4.0 does not define Oj::ParseError and instead raises SyntaxError on failure

# File lib/aws-sdk-core/json/oj_engine.rb, line 33
def detect_oj_parse_errors
  require 'oj'

  if Oj.const_defined?(:ParseError)
    [Oj::ParseError, EncodingError, JSON::ParserError]
  else
    [SyntaxError]
  end
rescue LoadError
  nil
end