           result.append(try decodeElement(element))
         }
         catch let error as JsonDecodeError {
-          errors[index] = error
+          errors.append((index, error))
         }
       }
 

        throw JsonDecodeError.WrongType(rawValue: json, expectedType: "Dictionary")
      }

      var errors: [String: JsonDecodeError] = [:]
      var result: [Key: Value] = [:]

      for (key, val) in dict {

  case MissingField
  case WrongType(rawValue: AnyObject, expectedType: String)
  case WrongEnumRawValue(rawValue: AnyObject, enumType: String)
  case ArrayElementErrors([(Int, JsonDecodeError)])
  case DictionaryErrors([(String, JsonDecodeError)])
  case StructErrors(type: String, errors: [(String, JsonDecodeError)])
}

class JsonDecoder {
  var errors: [(String, JsonDecodeError)] = []
  let dict: [String : AnyObject]

  init(json: AnyObject) throws {
