# Unknown Keys

There few different strategies on how to handle keys that are not specified in the model while converting data with `JTC.convert`

### IGNORE (default)

During conversion only required keys will be checked, others will be omitted. Even if there are keys that are not specified in the model data will NOT be considered as corrupted. Those keys will not be present in converted values.

```typescript
class User {
   public id: number;
   public name: string;
}

const USER_META = new ObjectMeta({
   builder: User,
   fields: {
      id: new NumberField(),
      name: new StringField(),
   }
});

const users = [
   { id: 1, name: `Vasya`, age: 24 },
   { id: 2, name: `Katya`, phone: `3809566624` },
   { id: 3, name: `Masha` },
];

const result = JTC.convert({
   id: `Users`,
   meta: new ObjectArrayMeta({ meta: USER_META }),
   values: users,
   SUnknownKey: `IGNORE`,
});

console.log(result.isCorrupted);    // false
console.log(result.converted.all);
```

{% hint style="info" %}
Keep in mind that "ERROR" and "SAVE" strategies will slow conversion down, depending on how much fields the model have
{% endhint %}

### ERROR

If some keys that are not specified in the model will be detected during conversion it will be considered as corruption. Those keys will not be present in converted values.

```typescript
class User {
   public id: number;
   public name: string;
}

const USER_META = new ObjectMeta({
   builder: User,
   fields: {
      id: new NumberField(),
      name: new StringField(),
   }
});

const users = [
   { id: 1, name: `Vasya`, age: 24 },
   { id: 2, name: `Katya`, phone: `3809566624` },
   { id: 3, name: `Masha` },
];

 const result = JTC.convert({
         id: `Users`,
         meta: new ObjectArrayMeta({ meta: USER_META }),
         values: users,
         SUnknownKey: `ERROR`
      });

      console.log(result.isCorrupted);    // true
      console.log(result.converted.valid);
      console.log(result.converted.corrupted)
```

### SAVE

Any additional fields that were detected during conversion will be transferred to the converted values and will NOT be considered as corruption.

```typescript
class User {
   public id: number;
   public name: string;
}

const USER_META = new ObjectMeta({
   builder: User,
   fields: {
      id: new NumberField(),
      name: new StringField(),
   }
});

const users = [
   { id: 1, name: `Vasya`, age: 24 },
   { id: 2, name: `Katya`, phone: `3809566624` },
   { id: 3, name: `Masha` },
];

const result = JTC.convert({
   id: `Users`,
   meta: new ObjectArrayMeta({ meta: USER_META }),
   values: users,
   SUnknownKey: `SAVE`
});

console.log(result.isCorrupted);    // false
console.log(result.converted.all);
```
