| Module | Rack::Utils::OkJson |
| In: |
lib/rack/utils/okjson.rb
|
Some parts adapted from golang.org/src/encoding/json/decode.go and golang.org/src/unicode/utf8/utf8.go
| Upstream | = | '43' |
| Utagx | = | 0b1000_0000 |
| Utag2 | = | 0b1100_0000 |
| Utag3 | = | 0b1110_0000 |
| Utag4 | = | 0b1111_0000 |
| Utag5 | = | 0b1111_1000 |
| Umaskx | = | 0b0011_1111 |
| Umask2 | = | 0b0001_1111 |
| Umask3 | = | 0b0000_1111 |
| Umask4 | = | 0b0000_0111 |
| Uchar1max | = | (1<<7) - 1 |
| Uchar2max | = | (1<<11) - 1 |
| Uchar3max | = | (1<<16) - 1 |
| Ucharerr | = | 0xFFFD |
| Ustrerr | = | "\xef\xbf\xbd" |
| Usurrself | = | 0x10000 |
| Usurr1 | = | 0xd800 |
| Usurr2 | = | 0xdc00 |
| Usurr3 | = | 0xe000 |
| Spc | = | ' '[0] |
| Unesc | = | {?b=>?\b, ?f=>?\f, ?n=>?\n, ?r=>?\r, ?t=>?\t} |
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.