     func codablePropertieValues() -> [String:AnyObject] {
         var codableProperties = [String:AnyObject]()
         let mirror = Mirror(reflecting: self)
-        codableProperties = getPropertieValuesWithMirror(mir: mirror)
+//        codableProperties = getPropertieValuesWithMirror(mir: mirror)
+        getResultFromMirror(mir: mirror, action: { (label, value) in
+            if label != nil {
+                codableProperties[label!] = unwrap(any: value) as AnyObject?
+            }
+        })
         return codableProperties
     }
     
+//    //遍历所有的属性列表，将所有的属性存储到数组中
+//    func getPropertiesWithMirror(mir : Mirror) -> [String] {
+//        var result: [String] = []
+//        if let superMirror = mir.superclassMirror {
+//            result = getPropertiesWithMirror(mir: superMirror)
+//        }
+//        for case let (label?, _) in (mir.children) {
+//            result.append(label)
+//        }
+//        return result
+//    }
+    
     //遍历所有的属性列表，将所有的属性存储到数组中
-    func getPropertiesWithMirror(mir : Mirror) -> [String] {
-        var result: [String] = []
-        if let superMirror = mir.superclassMirror {
-            result = getPropertiesWithMirror(mir: superMirror)
-        }
-        for case let (label?, _) in (mir.children) {
-            result.append(label)
-        }
-        return result
-    }
-    
-    //遍历所有的属性列表，将所有的属性存储到数组中
-    func codableProperties() -> [String] {
-        var codableProperties = [String]()
-        let mirror = Mirror(reflecting: self)
-        codableProperties = getPropertiesWithMirror(mir: mirror)
-        return codableProperties
+    func allProperties() -> [String] {
+        var allProperties = [String]()
+        let mirror = Mirror(reflecting: self)
+//        codableProperties = getPropertiesWithMirror(mir: mirror)
+        getResultFromMirror(mir: mirror, action: { (label, value) in
+            if label != nil {
+                allProperties.append(label!)
+            }
+        })
+        return allProperties
     }
     
     


import UIKit

//MARK: - add two dictionary
extension Dictionary {
    mutating func add(other:Dictionary?) {
        if other != nil {
            for (key,value) in other! {
                self.updateValue(value, forKey:key)
            }
        }
    }
}




//MARK: - JSON协议
//自定义一个JSON协议
protocol JSON {
    
    /// 如果是对象实现了JSON协议，这个方法返回对象属性及其value的dic，注意如果某个value不是基础数据类型，会一直向下解析直到基础数据类型为止，另外可选类型和数组需要单独处理
    /// 如果是基础数据类型实现了JSON协议，只返回他们自己

    ///
    /// - Parameter mir: mirror
    /// - Returns: dic
//    func getResultFromMirror(mir : Mirror) -> [String:AnyObject] {
//        var result: [String:AnyObject] = [:]
//        if let superMirror = mir.superclassMirror { //便利父类所有属性
//            result = getResultFromMirror(mir: superMirror)
//        }
//        if (mir.children.count) > 0  {
//            for case let (label?, value) in (mir.children) {
//                //属性：label   值：value
//                if let jsonValue = value as? JSON { //如果value实现了JSON，继续向下解析
//                    result[label] = jsonValue.toJSONModel()
//                }
//            }
//        }
//        return result
//    }
    
    /// 将数据转成可用的JSON模型
    func toJSONModel() -> AnyObject? {
        let mirror = Mirror(reflecting: self)
        if mirror.children.count > 0  {
//            let result = getResultFromMirror(mir: mirror)
            var result: [String:AnyObject] = [:]
            getResultFromMirror(mir: mirror, action: { (label, value) in
                //属性：label   值：value
                if let jsonValue = value as? JSON , label != nil { //如果value实现了JSON，继续向下解析
                    result[label!] = jsonValue.toJSONModel()
                }
            })
            return result as AnyObject?  //有属性的对象，返回result是一个dic
        }
        return self as AnyObject?  //基础数据类型，返回自己
