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.
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. |
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 a UTF8 encoded Ruby string string to a JSON string, encoded with UTF16 big endian characters as \u????, and return it.