Module: StatsCloud::JsonParser

Included in:
ClusterClient, ParsedResponseHelper
Defined in:
lib/statscloud/helpers/json_parser.rb

Overview

Json Parser helper.

Instance Method Summary collapse

Instance Method Details

#convert_to_pretty_json(json) ⇒ Object



14
15
16
# File 'lib/statscloud/helpers/json_parser.rb', line 14

def convert_to_pretty_json(json)
  json_service.pretty_generate parse_json(json)
end

#parse_json(json, default = {}) ⇒ Object



8
9
10
11
12
# File 'lib/statscloud/helpers/json_parser.rb', line 8

def parse_json(json, default = {})
  json_service.parse(json)
rescue JSON::ParserError
  default
end