Class: Sensu::JSON::JrJackson

Inherits:
Object
  • Object
show all
Defined in:
lib/sensu/json/jrjackson.rb

Overview

The Sensu JSON parser when running on JRuby.

Instance Method Summary collapse

Instance Method Details

#dump(object, options = {}) ⇒ Object

Dump (generate) a JSON string from a Ruby object.

Parameters:

  • object (Object)
  • options (Hash) (defaults to: {})


19
20
21
# File 'lib/sensu/json/jrjackson.rb', line 19

def dump(object, options={})
  ::JrJackson::Json.dump(object, options)
end

#load(string) ⇒ Object

Load (and parse) a JSON string. Sensu expects symbolized keys.

Parameters:

  • string (String)

Returns:

  • (Object)


11
12
13
# File 'lib/sensu/json/jrjackson.rb', line 11

def load(string)
  ::JrJackson::Json.load(string, :symbolize_keys => true, :raw => true)
end