CocoaPods trunk is moving to be read-only. Read more on the blog, there are 17 months to go.

SimpleJSONParser 1.0.1

SimpleJSONParser 1.0.1

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Jul 2016
SPMSupports SPM

Maintained by Ihor Rapalyuk.



  • By
  • Ihor Rapalyuk

Swift IOS Pod. SimpleJSONParser lets a user simply parse JSON to any NSObject.

Import:

    import SimpleJSONParser

Cocoapods:

    pod 'SimpleJSONParser'

1) Here is an example how it works

    let dictionary = NSMutableDictionary()
    dictionary.setValue("sdfsdf", forKey: "uniqueID")
    dictionary.setValue("valera", forKey: "name")
    dictionary.setValue("34", forKey: "age")

    let dictionary2 = NSMutableDictionary()
    dictionary2.setValue(["34", "56", "876"], forKey: "ids")
    dictionary.setValue(dictionary2, forKey: "test2")


    let test = TestClass.fromJson(dictionary)

2) Test Model

    import Foundation

    public class TestClass: NSObject {

        var uniqueID: String?
        var name: String?
        var age: Int = 0
        var test2: TestClass2?
    }

    public class TestClass2: NSObject {
        var ids: [String] = []
    }