module Sandal::Json

Contains JSON encode and decode functionality.

Public Class Methods

dump(raw) click to toggle source

Encodes a Ruby object as JSON. This version delegates to the included JSON engine.

@param raw The Ruby object to be encoded @return [String] The JSON string representation of the object.

# File lib/sandal/json.rb, line 19
def self.dump(raw)
  JSON.generate(raw)
end
load(encoded) click to toggle source

Decode a JSON string into Ruby. This version delegates to the included JSON engine.

@param encoded [String] The JSON string representation of the object. @return The decoded Ruby object.

# File lib/sandal/json.rb, line 11
def self.load(encoded)
  JSON.parse(encoded)
end