Sha256: 42022008585d3e1663df658d6b26495f993f2c62b6a8077947223d94cb1d2bbc
Contents?: true
Size: 488 Bytes
Versions: 5
Compression:
Stored size: 488 Bytes
Contents
class JSON class Malformed < StandardError ; end def self.parse(string, encoding=nil) error = Pointer.new(:object) data = NSJSONSerialization.JSONObjectWithData string.to_data(encoding), options:0, error:error if error[0] raise Malformed else data end end def self.generate(object, pretty=false) options = pretty ? NSJSONWritingPrettyPrinted : 0 NSJSONSerialization.dataWithJSONObject(object, options:options, error:nil).to_s end end
Version data entries
5 entries across 5 versions & 2 rubygems