Reputation: 263
The response of a request delivers a JSON. The structure of the JSON looks like this:
{
"32": {
"docKey": "32",
"outletId": 32,
"mdngOutlet": {
"outletBasic": {
"outletId": 32,
}
}
},
"33": {
"docKey": "32",
"outletId": 32,
"mdngOutlet": {
"outletBasic": {
"outletId": 32,
}
}
},
"34": {
"docKey": "32",
"outletId": 32,
"mdngOutlet": {
"outletBasic": {
"outletId": 32,
}
}
},
"35": {
"docKey": "32",
"outletId": 32,
"mdngOutlet": {
"outletBasic": {
"outletId": 32,
}
}
},
}
What does the interface look like? 32, 33, 34, ... seem to act like map. How can you use a map in an interface?
Upvotes: 0
Views: 71
Reputation: 2681
Typescript interface can have dynamic keys.
interface YourJSON{
[key: string]: yourObjectInterface
}
Upvotes: 1