Jquery向json对象添加键值对,读取键值对,删除键值对

发布时间 2023-09-06 22:26:13作者: James·wang

添加键值对

var labelName = {};
labelName["Name"]="James"
labelName["Sex"]="1"

结果:labelName={"Name":"James","Sex":1};

读取键值对

 var getData ={"Label":"Dong","Sex":"1","Address":"China"};
$.each(getData, function (key, value) {
    ……
 })

删除键值对

var getData ={"Label":"Dong","Sex":"1","Address":"China"};
delete getData["Label"];