module StatsCloud::JsonParser

Json Parser helper.

Public Instance Methods

convert_to_pretty_json(json) click to toggle source
# 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 = {}) click to toggle source
# File lib/statscloud/helpers/json_parser.rb, line 8
def parse_json(json, default = {})
  json_service.parse(json)
rescue JSON::ParserError
  default
end

Private Instance Methods

json_service() click to toggle source
# File lib/statscloud/helpers/json_parser.rb, line 20
def json_service
  JSON
end