Whenever I attempt to transmit an object containing an array of objects from my express route to the client, I receive an [Object object]. Then, when I try to convert it into a string using JSON.stringify, I end up with a convoluted string along with a console message.
var messages = "<%=(JSON.stringify(messages))%>"
console.log(messages)
This is what gets displayed in the console...
{"messages":[{"content":"cool mane","creator":"joe"},{"content":"test 4","creator":"joe"},{"content":" ewgdqf","creator":"joe"},
I expect to be able to iterate through the data by accessing messages[0].content, but instead, I am presented with a confusing string that hinders any further manipulation...
Any attempts at looping through the string only results in each character being printed individually.