{
"projects": [
{
"name":"Алеша"
]
}
function readTextFile(file, callback) {
var rawFile = new XMLHttpRequest();
rawFile.overrideMimeType("application/json");
rawFile.open("GET", file, true);
rawFile.onreadystatechange = function() {
if (rawFile.readyState === 4 && rawFile.status == "200") {
callback(rawFile.responseText);
}
}
rawFile.send(null);
}
//использование:
readTextFile("/Users/Documents/workspace/test.json", function(text){
var data = JSON.parse(text);
console.log(data);
});
var json = JSON.parse(ваш_json_объект);
console.log( json.projects[0].name )
$.getJSON("test.json", function(json) {
console.log(json[0]['name']);
});