Skip to content

sgxiang/BYJSON

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

BYJSON

简洁的JSON辅助库


License MIT

Requirements

  • iOS 8.0+
  • Xcode 7.0
  • Swift 2.0

Usage

import BYJSON
let data = NSData(contentsOfURL: NSURL(string: "http://httpbin.org/get?hello=world")!)!
do{
	let json : BYJson = try BYJson(data: data)
	print(json)
    //method
    print(json.isArray)          // false
    print(json.isDictionary)     // true
    print(json.isNumber)         // false
    print(json.isBool)           // false
    print(json.isString)         // false
    
    print(json.array)            // []
    print(json.dictionary)       // some dic
    print(json.number)           // 0
    print(json.bool)             // false
    print(json.string)           // ""
    
    print(json["args"]?.dictionary)         // ["hello":"world"]
    print(json[0])                         // nil
    print(json["args"]?["hello"]?.string)  // Optional("world")
    
}catch let error{
	print(error)
}

Communication

Author

About

简洁的JSON辅助库

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published