diff --git a/Sources/Mappable.swift b/Sources/Mappable.swift index 3be7fc1a..2b3dad86 100644 --- a/Sources/Mappable.swift +++ b/Sources/Mappable.swift @@ -46,7 +46,7 @@ public protocol StaticMappable: BaseMappable { static func objectForMapping(map: Map) -> BaseMappable? } -public extension BaseMappable { +public extension Mappable { /// Initializes object from a JSON String init?(JSONString: String, context: MapContext? = nil) { @@ -65,12 +65,15 @@ public extension BaseMappable { return nil } } - +} + +public extension BaseMappable { + /// Returns the JSON Dictionary for the object func toJSON() -> [String: Any] { return Mapper().toJSON(self) } - + /// Returns the JSON String for the object func toJSONString(prettyPrint: Bool = false) -> String? { return Mapper().toJSONString(self, prettyPrint: prettyPrint)