Module: Wayfarer::Parsers::JSONParser

Defined in:
lib/wayfarer/parsers/json_parser.rb

Overview

A wrapper class for parsing JSON.

Class Method Summary collapse

Class Method Details

.parse(json_str) ⇒ OpenStruct

Parses a JSON string.

Parameters:

  • json_str (String)

    the JSON string to parse.

Returns:

  • (OpenStruct)

15
16
17
# File 'lib/wayfarer/parsers/json_parser.rb', line 15

def parse(json_str)
  RUBY_PLATFORM == "java" ? JSON.parse(json_str) : Oj.load(json_str)
end