class MultiJson::Adapters::OkJson
Constants
- ParseError
Public Instance Methods
dump(object, options={})
click to toggle source
# File lib/multi_json/adapters/ok_json.rb, line 19 def dump(object, options={}) ::MultiJson::OkJson.valenc(stringify_keys(object)) end
load(string, options={})
click to toggle source
# File lib/multi_json/adapters/ok_json.rb, line 11 def load(string, options={}) string = string.read if string.respond_to?(:read) result = ::MultiJson::OkJson.decode("[#{string}]").first options[:symbolize_keys] ? symbolize_keys(result) : result rescue ArgumentError # invalid byte sequence in UTF-8 raise ParseError end