我想解析一个JSON文件,这就是我所做的:
var producteur = $.parseJSON(lot.json);
我做过像你告诉我的事情:
var recuperation = $.getJSON("lots.json", function(json){ var parsing = $.parseJSON(recuperation);
第一部分是工作:getJson但$ .Parse json不起作用你知道为什么感谢。
答案 0 :(得分:0)
您需要先检索文件。
$.parseJSON
仅将JSON字符串解析为javascript对象。使用$.getJSON
发出检索请求。
使用:
$.getJSON('lot.json', function( response){
/* do something with response here.
It is a javascript object/array already converted by jQuery*/
})