Module: MicroJSON

Defined in:
lib/moon/packages/micro_json/micro_json.rb

Overview

Minimal implementation of JSON using pure ruby.

Defined Under Namespace

Classes: Decoder, Encoder

Class Method Summary collapse

Class Method Details

.dump(o, options = {}) ⇒ String

Dump a ruby object to JSON.

Parameters:

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

    @option options [Boolean] :symbols should symbols be dumped appended with ':' ?

Returns:


538
539
540
# File 'lib/moon/packages/micro_json/micro_json.rb', line 538

def self.dump(o, options = {})
  Encoder.encode(o, options)
end

.load(str, options = {}) ⇒ Object

Load a JSON object as ruby.

Parameters:

Returns:


546
547
548
# File 'lib/moon/packages/micro_json/micro_json.rb', line 546

def self.load(str, options = {})
  Decoder.decode(str, options)
end