Class: GenesisRuby::Parsers::Json

Inherits:
Base
  • Object
show all
Defined in:
lib/genesis_ruby/parsers/json.rb

Overview

JSON Document parser

Instance Attribute Summary

Attributes inherited from Base

#root_node_skipped, #structure

Instance Method Summary collapse

Methods inherited from Base

#initialize, #skip_root_node

Constructor Details

This class inherits a constructor from GenesisRuby::Parsers::Base

Instance Method Details

#parse_document(document) ⇒ Object

Parse received document



12
13
14
15
16
# File 'lib/genesis_ruby/parsers/json.rb', line 12

def parse_document(document)
  @structure = JSON.parse(document, symbolize_names: true)
rescue StandardError => e
  raise ParserError, "Given JSON string can not be parsed! #{e.message}"
end