I got data from an external interface and the data structure is kind of strange. I am trying to build a typescript interface for it.
{
"userIds": {
"431a87306b4bcba4": {
"user_name": "JonDoe",
"first_name": "Jon",
"last_name": "Doe",
"name": "JonDoe"
},
"141a87306b4bcba4": {
"user_name": "JonDoe2",
"first_name": "Jon2",
"last_name": "Doe2",
"name": "JonDoe2"
}
}
}
My idea was this, but I think it is not correct.
export class Data {
userIds: Dic;
}
interface Dic {
[key: string]: User
}
export class User {
user_name: string;
first_name: string;
last_name: string;
name: string;
}
Would be glad if one of you type experts could help me - thanks :)