我是 jQuery 新手,我找到了一个示例,通过使用该示例,我解析了我的 json 字符串,如下所示,但我发现所有输出都是未定义的而不是值。
$(document).ready(function() {
$(document).bind("contextmenu",function(e){
return false;
});
var jsonp = '{"members":[{"User_name":"Vrushank","Email":"eqr@ewr.in"},{"User_name":"dfdaf","Email":"afafi@df.in"},{"User_name":"vimlesh","Email":"vimlesh@lidsfdthe.in"},{"User_name":"nirav","Email":"havsr@lifgffe.in"},{"User_name":"parth","Email":"vasavada@zfs.in"},{"User_name":"fsd","Email":"test.test@gmail.com"}]}';
var lang = '';
var user = '';
var email = '';
alert(jsonp);
var obj = $.parseJSON(jsonp);
//alert(obj);
$.each(obj, function() {
lang += this['members'];
alert(lang);
$.each(lang, function() {
user = this['User_name'];
email = this['Email'];
$('span').append(user +":"+email+"<br/>");
user="";email="";
});
});
});