Module: Occi::Core::Helpers::RawJsonParser

Included in:
Parsers::Json::ActionInstance, Parsers::Json::Category, Parsers::Json::Entity
Defined in:
lib/occi/core/helpers/raw_json_parser.rb

Overview

Introduces JSON parsing to various parser classes. This allowes parsers to convert JSON-formatted text into hashes.

Author:

Instance Method Summary collapse

Instance Method Details

#raw_hash(body) ⇒ Object

:nodoc:


10
11
12
13
14
# File 'lib/occi/core/helpers/raw_json_parser.rb', line 10

def raw_hash(body)
  JSON.parse body, symbolize_names: true
rescue => ex
  raise Occi::Core::Errors::ParsingError, "JSON parsing failed: #{ex.message}"
end