Error displaying vector variable

1

Good night guys, I need a help with a vector in JS ...

When I enter this way it works OK, it displays all messages, but when I put the test variable in place it does not display anything:

var teste = document.getElementById('conversa').innerHTML; 
return {
		"messages":[
			{"_id":"57","text":"oi mae","userId":"54","date":"2016-10-19T13:45:00.000Z"},{"_id":"54","text":"Oi filho","userId":"57","date":"2016-10-19T13:47:00.000Z"},{"_id":"54","text":"Leo","userId":"57","date":"2016-10-19T13:51:00.000Z"},{"_id":"54","text":"...","userId":"57","date":"2016-10-19T13:52:00.000Z"},{"_id":"54","text":"Ha","userId":"57","date":"2016-10-19T13:52:00.000Z"},{"_id":"54","text":"XD","userId":"57","date":"2016-10-19T13:56:00.000Z"},{"_id":"54","text":"...","userId":"57","date":"2016-10-19T13:56:00.000Z"},{"_id":"54","text":"Ahh","userId":"57","date":"2016-10-19T13:57:00.000Z"},{"_id":"54","text":"T","userId":"57","date":"2016-10-19T13:58:00.000Z"},{"_id":"54","text":"F","userId":"57","date":"2016-10-19T13:59:00.000Z"},{"_id":"54","text":"X","userId":"57","date":"2016-10-19T14:02:00.000Z"},{"_id":"54","text":"Kk","userId":"57","date":"2016-10-19T14:03:00.000Z"},{"_id":"54","text":"Xp","userId":"57","date":"2016-10-19T14:06:00.000Z"},{"_id":"54","text":"...","userId":"57","date":"2016-10-19T14:08:00.000Z"},{"_id":"57","text":"ok","userId":"54","date":"2016-10-19T14:08:00.000Z"},{"_id":"54","text":"Jdjjd","userId":"57","date":"2016-10-19T14:09:00.000Z"},{"_id":"54","text":"K","userId":"57","date":"2016-10-19T14:14:00.000Z"},{"_id":"57","text":"leo","userId":"54","date":"2016-10-19T14:14:00.000Z"},{"_id":"57","text":"ke","userId":"54","date":"2016-10-19T14:16:00.000Z"},{"_id":"54","text":"L","userId":"57","date":"2016-10-19T14:16:00.000Z"},{"_id":"57","text":"leo","userId":"54","date":"2016-10-20T16:40:00.000Z"},{"_id":"57","text":"leo","userId":"54","date":"2016-10-20T16:41:00.000Z"},
		]
	  };

Could help me with a solution, I need the data to be dynamic within the "messages" vector ... and this test variable is dynamic, but when I insert it inside it does not display anything on the page.

Note: All this content

{"_id":"57","text":"oi mae","userId":"54","date":"2016-10-19T13:45:00.000Z"},{"_id":"54","text":"Oi filho","userId":"57","date":"2016-10-19T13:47:00.000Z"},{"_id":"54","text":"Leo","userId":"57","date":"2016-10-19T13:51:00.000Z"},{"_id":"54","text":"...","userId":"57","date":"2016-10-19T13:52:00.000Z"},{"_id":"54","text":"Ha","userId":"57","date":"2016-10-19T13:52:00.000Z"},{"_id":"54","text":"XD","userId":"57","date":"2016-10-19T13:56:00.000Z"},{"_id":"54","text":"...","userId":"57","date":"2016-10-19T13:56:00.000Z"},{"_id":"54","text":"Ahh","userId":"57","date":"2016-10-19T13:57:00.000Z"},{"_id":"54","text":"T","userId":"57","date":"2016-10-19T13:58:00.000Z"},{"_id":"54","text":"F","userId":"57","date":"2016-10-19T13:59:00.000Z"},{"_id":"54","text":"X","userId":"57","date":"2016-10-19T14:02:00.000Z"},{"_id":"54","text":"Kk","userId":"57","date":"2016-10-19T14:03:00.000Z"},{"_id":"54","text":"Xp","userId":"57","date":"2016-10-19T14:06:00.000Z"},{"_id":"54","text":"...","userId":"57","date":"2016-10-19T14:08:00.000Z"},{"_id":"57","text":"ok","userId":"54","date":"2016-10-19T14:08:00.000Z"},{"_id":"54","text":"Jdjjd","userId":"57","date":"2016-10-19T14:09:00.000Z"},{"_id":"54","text":"K","userId":"57","date":"2016-10-19T14:14:00.000Z"},{"_id":"57","text":"leo","userId":"54","date":"2016-10-19T14:14:00.000Z"},{"_id":"57","text":"ke","userId":"54","date":"2016-10-19T14:16:00.000Z"},{"_id":"54","text":"L","userId":"57","date":"2016-10-19T14:16:00.000Z"},{"_id":"57","text":"leo","userId":"54","date":"2016-10-20T16:40:00.000Z"},{"_id":"57","text":"leo","userId":"54","date":"2016-10-20T16:41:00.000Z"},

It is within the teste variable.

    
asked by anonymous 20.10.2016 / 23:11

0 answers