I am facing an issue with my TypeScript
code where I need to retrieve specific information from a response. Specifically, I want to output the values of internalCompanyCode
and timestamp
.
The Problem:
An error is occurring due to an implicit 'any' type because the index expression is not recognized as a 'number'.(
//const json = JSON.stringify(result, null, 2)
// json is the result of JSON.stringify(...)
const json = [
{
"internalCompanyCode": "007",
"moreInfo": [
{
"dimensions": {
"height": 27,
"width": 31,
"length": 61
},
"currenStatus": {
"arrived": {
"timestamp": "10:00:12"
}
}
}
]
}
]
console.log(json['internalCompanyCode'])
console.log(json['moreInfo']['dimensions']['height'])