 		return nil
 	}
 }
+
+extension Dictionary {
+	private func map<K: Hashable, V>(f: Element -> (K, V)) -> [K : V] {
+		var mapped = [K : V]()
+
+		for element in self {
+			let newElement = f(element)
+			mapped[newElement.0] = newElement.1
+		}
+
+		return mapped
+	}
+}


	/// Maps a dictionary of Objects to a JSON dictionary of dictionary.
	public func toJSONDictionary(dictionary: [String : N]) -> [String : [String : AnyObject]] {
		var parsed = [String : [String : AnyObject]]()

		for (k, v) in dictionary {
			let mapped = toJSON(v)
			parsed[k] = mapped
		}

		return parsed
	}

	/** 


	/// Maps a JSON dictionary of dictionary to a dictionary of object that conforms to Mappable.
	public func mapDictionary(JSON: [String : [String : AnyObject]]) -> [String : N] {
		return JSON.map { k, v in
			return (k, self.map(v))
		}
	}

	// MARK: public toJSON functions
