I have a div which outputs as text a json format:
HTML
<div id="myMap"></div>
JS
$('#myMap').text(JSON.stringify(out[0], null, 2));
That gives me:
{ "name": "Leopardi", "children": [ { "name": "Vita", "children": [ { "name": "Ubriacone" } ] }, { "name": "Poesie", "children": [ { "name": "L'infinito" } ] } ] }
Now I need to set that as a variable to be able to read it and this is what I am doing but I get nothing at all:
var root = $('#myMap').text();
I am trying to have the output like:
var root = {
"name": "flare",
"url": "http://google.com",
"children": [
{
"name": "an...