I have that JSON 'media' object that looks like this:
const media = [{
"0": {
"small": "",
"large": ""
}
}];
I have to type it this way:
export interface Media {
0: {
large: string
medium: string
small: string,
type: string
}
}
in order to be able to access it, via element[0].small
.
All the JSON objects I am working with are like the following, with an index equals to 0
, which is not very useful but I can't change it.
Is there any way I can access my properties just by doing element.small
?