# DGM Interview with Sang
## Implementation Challenge: Data Conversion
You're migrating data from one CMS to another, and the origin CMS stores a page layout with a type like this:
```typescript=
interface SrcComponentInstance {
// the name of the target component
name: string;
// arguments given to the component
args: {
// name of the argument
name: string;
// value of the argument
value: JSONValue;
}[];
// the contents of the component
contents: (SrcComponentInstance | string)[];
};
```
The target CMS uses a different approach, giving a unique identifier to every single component and text snippet and using those references.
```typescript=
type Language = 'eng' | 'fra' | 'spa';
interface DestComponentInstance {
// unique identifier for this component
id: Id;
// the name of the target component
name: string;
// the arugements given to the component
args: {[k in string]?: JSONValue};
// the ids of each child instance of the component
contents: Id[];
};
interface DestTextInstance {
// unique identifier for this text
id: Id;
// the content text, depending on the language
content: {[k in Language]?: string};
};
```
Write a function that converts a list of top level `SrcComponentInstance`s to `DestComponentInstance`s:
```typescript=
const convert = (src: SrcComponentInstance[]): {[id in Id]?: DestComponentInstance} => {
}
```