Module Rufus::Json
In: lib/rufus/json.rb

Methods

Classes and Modules

Class Rufus::Json::ParserError

Constants

VERSION = '0.2.5'
JSON = [ lambda { |o, opts| opts[:max_nesting] = false unless opts.has_key?(:max_nesting)   The JSON / JSON pure decoder
ACTIVE_SUPPORT = [ lambda { |o, opts| ActiveSupport::JSON.encode(o, opts) }, lambda { |s| decode_e(s) || ActiveSupport::JSON.decode(s) }, #lambda { ::ActiveSupport::JSON::ParseError } lambda { RuntimeError }   The Rails ActiveSupport::JSON decoder
ACTIVE = ACTIVE_SUPPORT
YAJL = [ lambda { |o, opts| Yajl::Encoder.encode(o, opts) }, lambda { |s| Yajl::Parser.parse(s) }, lambda { ::Yajl::ParseError }   github.com/brianmario/yajl-ruby/
NONE = [ lambda { |o, opts| raise 'no JSON backend found' }, lambda { |s| raise 'no JSON backend found' }, lambda { raise 'no JSON backend found' }   The "raise an exception because there‘s no backend" backend
E_REGEX = /^\d+(\.\d+)?[eE][+-]?\d+$/

Public Class methods

Returns :yajl|:json|:active|:none (an identifier for the current backend)

Forces a decoder JSON/ACTIVE_SUPPORT or any lambda pair that knows how to deal with JSON.

It‘s OK to pass a symbol as well, :yajl, :json, :active (or :none).

Decodes the given JSON string.

Let‘s ActiveSupport do the E number notation.

[Re-]Attempts to detect a JSON backend

Duplicates an object by turning it into JSON and back.

Don‘t laugh, yajl-ruby makes that faster than a Marshal copy.

Encodes the given object to a JSON string.

Returns true if there is a backend set for parsing/encoding JSON

Pretty encoding

[Validate]