Cómo utilizar JS local para leer directamente archivos de extensión .json
lt;script language="javascript"gt;
función getjson(){
var xmlReq
try{
xmlReq = new ActiveXObject("Microsoft.XMLHTTP");
var web = "1.json"; // ruta del archivo json
// Método asincrónico
xmlReq .open("GET", web, verdadero);
xmlReq.onreadystatechange = function()onreadystatechange = function(){
if (xmlReq.readystate == 4){
document.write(xmlReq.responseText); //Operación sobre el documento en json
}
}
xmlReq.send(
xmlReq.send();
xmlReq.send()send();
catch(e){
alert(e);
}
}
lt;/scriptgt;
Referencia/indexchen/article/details /543209