Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. extension User {
  2. func toJSON() -> [String : Any] {
  3. var json = [String : Any]()
  4. json["firstName"] = firstName
  5. json["lastName"] = lastName
  6. json["age"] = age
  7. json["friends"] = friends.map { $0.toJSON() }
  8. json["coworkers"] = coworkers.map { $0.toJSON() }
  9. json["favorites"] = favorites.map { $0.toJSON() }
  10. json["messages"] = messages.map { $0.toJSON() }
  11. json["notes"] = notes.map { $0.toJSON() }
  12. json["tasks"] = tasks.map { $0.toJSON() }
  13. json["imageURLs"] = imageURLs.map { $0.absoluteString }
  14. json["groups"] = groups.map { $0.toJSON() }
  15. return json
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement