Module: LogStash::Json
Instance Method Summary collapse
Instance Method Details
#jruby_dump(o, options = {}) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/logstash/json.rb', line 19 def jruby_dump(o, ={}) # TODO [guyboertje] remove these comments in 5.0 # test for enumerable here to work around an omission in JrJackson::Json.dump to # also look for Java::JavaUtil::ArrayList, see TODO submit issue # o.is_a?(Enumerable) ? JrJackson::Raw.generate(o) : JrJackson::Json.dump(o) JrJackson::Base.generate(o, ) rescue => e raise LogStash::Json::GeneratorError.new(e.) end |
#jruby_load(data, options = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/logstash/json.rb', line 9 def jruby_load(data, = {}) # TODO [guyboertje] remove these comments in 5.0 # options[:symbolize_keys] ? JrJackson::Raw.parse_sym(data) : JrJackson::Raw.parse_raw(data) JrJackson::Ruby.parse(data, ) rescue JrJackson::ParseError => e raise LogStash::Json::ParserError.new(e.) end |