             
             serializedComps.append(serialize(ser))
         }
-        
-        data["components"].arrayObject = serializedComps.map { $0.serialized().object }
-        
-        return Serialized(typeName: name, contentType: type, data: data)
+
+        let serializedEntity = SerializedEntity(id: entity.id, type: entity.type, components: serializedComps)
+        
+        return Serialized(typeName: name, contentType: type, data: serializedEntity.serialized())
     }
     
     /// Serializes a game space passed in.

        if serialized.typeName != "Entity" || serialized.contentType != .entity {
            throw DeserializationError.invalidSerialized(message: "Does not represent a plain serialized Entity instance")
        }
        
        guard let id = serialized.data["id"].int else {
            throw DeserializationError.invalidSerialized(message: "Missing 'id'")
        }
        guard let type = serialized.data["type"].int else {
            throw DeserializationError.invalidSerialized(message: "Missing 'type'")
        }
        guard let components = serialized.data["components"].array else {
            throw DeserializationError.invalidSerialized(message: "Missing 'components'")
        }
        
        let serialComps: [Serialized] = try components.map {
            try Serialized(json: $0)
        }
        let comps: [Component] = try serialComps.map {
            try extract(from: $0)
        }
        
        let entity = Entity(components: comps)
        entity.id = id
        entity.type = type
        
        return entity
    }

/// state of the object remains the same when deserializing from a previously
/// serialized object.
public protocol Serializable {
    /// Serializes the state of this component into a JSON object.
    ///
    /// - Returns: The serialized state for this object.
