Module JSON
In: lib/facets/more/json.rb

This module is the namespace for all the JSON related classes. It also defines some module functions to expose a nicer API to users, instead of using the parser and other classes directly.

Methods

Classes and Modules

Class JSON::Parser
Class JSON::State

Constants

JSONError = Class.new StandardError   The base exception for JSON errors.
ParserError = Class.new JSONError   This exception is raise, if a parser error occurs.
UnparserError = Class.new JSONError   This exception is raise, if a unparser error occurs.
CircularDatastructure = Class.new UnparserError   If a circular data structure is encountered while unparsing this exception is raised.
UTF16toUTF8 = Iconv.new('utf-8', 'utf-16be')   An iconv instance to convert from UTF8 to UTF16 Big Endian.
UTF8toUTF16 = Iconv.new('utf-16be', 'utf-8');   An iconv instance to convert from UTF16 Big Endian to UTF8.

Public Class methods

Switches on Unicode support, if enable is true. Otherwise switches Unicode support off.

Returns true if JSON supports unicode, otherwise false is returned.

Public Instance methods

Parse the JSON string source into a Ruby data structure and return it.

Unparse the Ruby data structure obj into a JSON string and return it. The returned string is a prettier form of the string returned by unparse.

Unparse the Ruby data structure obj into a single line JSON string and return it. state is a JSON::State object, that can be used to configure the output further.

Convert string from UTF16 (big endian) encoding to UTF8 encoding and return it.

Convert a UTF8 encoded Ruby string string to a JSON string, encoded with UTF16 big endian characters as \u????, and return it.

Convert string from UTF8 encoding to UTF16 (big endian) encoding and return it.

[Validate]