Module MultiJson::OkJson
In: lib/multi_json/vendor/ok_json.rb

Methods

abbrev   arrenc   arrparse   decode   eat   encode   falsetok   hexdec4   hexenc4   keyenc   lex   nibble   nulltok   numenc   numtok   objenc   objparse   pairparse   strenc   strtok   subst   surrogate?   textparse   tok   truetok   uchardec   ucharenc   unquote   unsubst   valenc   valparse  

Classes and Modules

Class MultiJson::OkJson::Error

Constants

Utagx = 0x80
Utag2 = 0xc0
Utag3 = 0xe0
Utag4 = 0xf0
Utag5 = 0xF8
Umaskx = 0x3f
Umask2 = 0x1f
Umask3 = 0x0f
Umask4 = 0x07
Uchar1max = (1<<7) - 1
Uchar2max = (1<<11) - 1
Uchar3max = (1<<16) - 1
Ucharerr = 0xFFFD
Usurrself = 0x10000
Usurr1 = 0xd800
Usurr2 = 0xdc00
Usurr3 = 0xe000
Umax = 0x10ffff
Spc = ' '[0]
Unesc = {?b=>?\b, ?f=>?\f, ?n=>?\n, ?r=>?\r, ?t=>?\t}
Hex = '0123456789abcdef'

Public Instance methods

Parses an "array" in the sense of RFC 4627. Returns the parsed value and any trailing tokens.

Decodes a json document in string s and returns the corresponding ruby value. String s must be valid UTF-8. If you have a string in some other encoding, convert it first.

String values in the resulting structure will be UTF-8.

Encodes x into a json text. It may contain only Array, Hash, String, Numeric, true, false, nil. (Note, this list excludes Symbol.) X itself must be an Array or a Hash. No other value can be encoded, and an error will be raised if x contains any other value, such as Nan, Infinity, Symbol, and Proc, or if a Hash key is not a String. Strings contained in x must be valid UTF-8.

Sans s and returns a list of json tokens, excluding white space (as defined in RFC 4627).

Parses an "object" in the sense of RFC 4627. Returns the parsed value and any trailing tokens.

Parses a "member" in the sense of RFC 4627. Returns the parsed values and any trailing tokens.

Parses a "json text" in the sense of RFC 4627. Returns the parsed value and any trailing tokens. Note: this is almost the same as valparse, except that it does not accept atomic values.

Scans the first token in s and returns a 3-element list, or nil if no such token exists.

The first list element is one of ’{’, ’}’, ’:’, ’,’, ’[’, ’]’, :val, :str, and :space.

The second element is the lexeme.

The third element is the value of the token for :val and :str, otherwise it is the lexeme.

Decodes unicode character u from UTF-8 bytes in string s at position i. Returns u and the number of bytes read.

Encodes unicode character u as UTF-8 bytes in string a at position i. Returns the number of bytes written.

Converts a quoted json string literal q into a UTF-8-encoded string. The rules are different than for Ruby, so we cannot use eval. Unquote will raise an error if q contains control characters.

Parses a "value" in the sense of RFC 4627. Returns the parsed value and any trailing tokens.

[Validate]