Skip to content

A basic library for working with JSON in Swift.

License

Notifications You must be signed in to change notification settings

sirwart/json-swift

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json-swift

A basic library for working with JSON in Swift.

Some sample usage from one of the tests:

var json : JSON = [
    "stat": "ok",
    "blogs": [
        "blog": [
            [
                "id" : 73,
                "name" : "Bloxus test",
                "needspassword" : JSTrue,
                "url" : "http://remote.bloxus.com/"
            ],
            [
                "id" : 74,
                "name" : "Manila Test",
                "needspassword" : JSFalse,
                "url" : "http://flickrtest1.userland.com/"
            ]
        ]
    ]
]

XCTAssertEqualObjects(json["stat"]?.string!, "ok")
XCTAssertTrue(json["blogs"]?["blog"] != nil)

XCTAssertEqualObjects(json["blogs"]?["blog"]?[0]?["id"]?.number!, 73)
XCTAssertTrue(json["blogs"]?["blog"]?[0]?["needspassword"]?.bool!)

About

A basic library for working with JSON in Swift.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 98.0%
  • C++ 2.0%