Sha256: 01037ed49624f98a1605b591d2fc391ae1bf07299982b80338e417f8fff3fe2a
Contents?: true
Size: 1.16 KB
Versions: 96
Compression:
Stored size: 1.16 KB
Contents
framework 'Foundation' require 'multi_json/adapters/ok_json' module MultiJson module Adapters module Nsjsonserialization extend self, MultiJson::Adapters::OkJson ParseError = ::MultiJson::OkJson::Error def load(string, options={}) string = string.read if string.respond_to?(:read) data = string.dataUsingEncoding(NSUTF8StringEncoding) object = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingMutableContainers | NSJSONReadingMutableLeaves, error: nil) if object object = symbolize_keys(object) if options[:symbolize_keys] object else super(string, options={}) end end def dump(object, options={}) pretty = options[:pretty] ? NSJSONWritingPrettyPrinted : 0 object = object.as_json if object.respond_to?(:as_json) if NSJSONSerialization.isValidJSONObject(object) data = NSJSONSerialization.dataWithJSONObject(object, options: pretty, error: nil) NSMutableString.alloc.initWithData(data, encoding: NSUTF8StringEncoding) else super(object, options) end end end end end
Version data entries
96 entries across 94 versions & 7 rubygems