Sha256: 5c2e49a24bb39850e5d4b9e9ad765c229e613b9712b4cd2d37713120cef12ad9
Contents?: true
Size: 549 Bytes
Versions: 3
Compression:
Stored size: 549 Bytes
Contents
module Overlord module JsonParser # The various json parsers can choke on various json so try them all def parse_json(data) try_crack(data) || try_json(data) || try_active_json(data) end def try_crack(data) Crack::JSON.parse(data) rescue => ex #puts ex nil end def try_json(data) JSON.parse(data) rescue => ex #puts ex nil end def try_active_json(data) ActiveSupport::JSON.decode(data) rescue => ex #puts ex nil end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
overlord-3.0.2 | lib/overlord/parse_json.rb |
overlord-3.0.1 | lib/overlord/parse_json.rb |
overlord-3.0.0 | lib/overlord/parse_json.rb |