To je marny :) Aby bylo jasno, tak s json jsem nikdy nedelal. Takze vubec nevim, jak vypada html kod, ktery ti to vypise. A bez nej nemuzu rici, co s tim udela javascript prohlizece :)
string(431) "[{"0":" - to vypise nejspis php prikaz vardump, to je mi na prd, protoze v html kodu stranky to muze vypadat jinak. Aspon zrovna ted neumim odhadnout, jestli tam budou ci nebudou ty apostrofy.
Ano, klicovy je radek
var markers = <?php echo json_encode($json); ?>;
Ale toto byl vypis z editoru, kde pises php kod. Pro javascript je podstatny html kod, ktery php odesle prohlizeci. Ten se da ve FF zobrazit treba pres ctrl+u. Php kod ja si nemuzu na svem pc pustit, kdyz nemam tvou db, takze ho nemuzu testovat, kdezto html kod ano.
Predpokladejme, ze by html kod mohl vypadat nejak takto...
<script>
var x;
x = '[\n\
{\n\
"0":"1",'+"\n"+'\
"id":"1",'+"\n"+'\
"1":"balabfldf",'+"\n"+'\
"name":"ddjfbdvldjfd",'+"\n"+'\
"2":"lorem ipsum",'+"\n"+'\
"address":"lorem ipsum",'+"\n"+'\
"3":"13.695411",'+"\n"+'\
"lat":"13.695411",'+"\n"+'\
"4":"50.504982",'+"\n"+'\
"lng":"50.504982",'+"\n"+'\
"5":"default",'+"\n"+'\
"type":"default"'+"\n"+'\
},'+"\n"+'\
{'+"\n"+'\
"0":"2",'+"\n"+'\
"id":"2",'+"\n"+'\
"1":"bldjfldfbdfl",'+"\n"+'\
"name":"bfkdjflhdlbadlf",'+"\n"+'\
"2":"lorem ipsum",'+"\n"+'\
"address":"lorem ipsum",'+"\n"+'\
"3":"16.524458",'+"\n"+'\
"lat":"16.524458",'+"\n"+'\
"4":"48.981186",'+"\n"+'\
"lng":"48.981186",'+"\n"+'\
"5":"default",'+"\n"+'\
"type":"default"}'+"\n"+'\
]';
x = x.replace(/"([\d\w]+)"(:)/g,"$1$2");
//alert(x.toSource())
x = eval(x);
//alert(x.toSource())
alert(x[0].lat)
</script>
:"lorem ipsum," - tady schazi uvozovka, opakuje se to tam jeste 3x
:"lorem ipsum","
(ty \n tam mam jen proto, aby mi chybova konzola prohlizece vypsala presne radek, kde je problem, ale mozna by to slo i bez toho)