Skip to content

Instantly share code, notes, and snippets.

@flandy84
Last active April 6, 2016 07:41
Show Gist options
  • Save flandy84/3edde5fb83f2eb659676c5593f287ff6 to your computer and use it in GitHub Desktop.
Save flandy84/3edde5fb83f2eb659676c5593f287ff6 to your computer and use it in GitHub Desktop.
import Foundation
public class LoginRequest {
public var userId: String = ""
public var password: String = ""
public init(userId: String, password: String) {
self.userId = userId
self.password = password
}
public init(json: JSON) {
userId = json["user"]["userId"].stringValue
password = json["user"]["password"].stringValue
}
public func toJSON() -> JSON{
// {
// "user" : {
// "userId" : "USER",
// "password" : "PASS",
// }
// }
let bodyJSONDictionary = JSON(
[ "user" :
[
"userId" : userId,
"password" : password,
]
])
return bodyJSONDictionary
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment