Module: Jerakia::Datasource::File::Json

Defined in:
lib/jerakia/datasource/file/json.rb

Constant Summary collapse

EXTENSION =
'json'.freeze

Instance Method Summary collapse

Instance Method Details

#convert(data) ⇒ Object


7
8
9
10
11
12
13
14
# File 'lib/jerakia/datasource/file/json.rb', line 7

def convert(data)
  return {} if data.empty?
  begin
    JSON.load(data)
  rescue JSON::ParserError => e
    raise Jerakia::FileParseError, "Could not parse JSON content, #{e.message}"
  end
end