 		return String(data: data, encoding: .utf8)
 	}
 	
-	fileprivate func setupCommons() {
+	fileprivate func setupCommons(withConfig config: JsonConfig? = nil) {
 		self.commons.valueBlock = { (instance: AnyObject, value, key) -> AnyObject? in
 			return (instance as! NSObject).value(forKey: key) as AnyObject
 		}

		commons.arrayValueBlock = nil
	}
	
	fileprivate func jsonArray(fromObjects objects: [AnyObject], withTypeInfo typeInfo: TypeInfo) -> AnyObject {
		if self.commons.isPrimitiveType(typeInfo.typeName) {
			return objects as AnyObject
		}

	
	/// Writes a json formatted string from a Swift class object.
	///
	/// - Parameters:
	///   - anyObject: instance of an object to be written.
	///   - config: optional parameter with custom writing configs
	/// - Returns: a String of json formatted representation of the anyObject.
	public func write<T : NSObject>(anyObject: T, withConfig config: JsonConfig? = nil) -> String? {
		self.setupCommons(withConfig: config)
		
		let jsonObject = self.commons.write(fromObject: anyObject, withConfig: config)
		
		self.unsetupCommons()
		
