I have a json string received from websocket :
{
"type":"newLoan",
"cartItems":{
"numberOfItems":null,
"bookList":[
{
"id":"1",
"title":"The Count of Monte Cristo",
"author":"Alexandre Dumas ",
"genre":"Comedy",
"returnDate":"January 15"
}
]
}
}
This result is shown after console.log(receivedMessage)
, but when I try to access type property by console.log(receivedMessage["type"])
it gives me undefined.
Still the same with console.log(receivedMessage.type)
.
How could I access the type property?