我怎样才能在jquery中读取json

时间:2015-09-26 10:48:48

标签: jquery json

{
    "Employment_from_date":[
        "From Date cannot be blank."
    ],
    "Employment_to_date":[
        "To Date cannot be blank."
    ],
    "Employment_company":[
        "Company cannot be blank."
    ],
    "Employment_designation":[
        "Designation cannot be blank."
    ]
}

1 个答案:

答案 0 :(得分:0)

var json= 
{
    "Employment_from_date":[
        "From Date cannot be blank."
    ],
    "Employment_to_date":[
        "To Date cannot be blank."
    ],
    "Employment_company":[
        "Company cannot be blank."
    ],
    "Employment_designation":[
        "Designation cannot be blank."
    ]
};

$.each(json,function(key,item)
 {
    alert(key + " = "+ item);
});