json添加和删除数据

时间:2018-04-26
贴一段实例代码,不再过多介绍,希望大家能够明白!

        //{"F_DepartmentId":"8684502a-5dc2-487c-b589-48d2eb7734c1","F_ManagerId":"feige"}
        var postData = $(".form").GetWebControls(keyValue);
        var did = postData["F_DepartmentId"];
        var mid = postData["F_ManagerId"];

        //删除原来的json值
        delete postData["F_DepartmentId"];
        delete postData["F_ManagerId"];

        //添加新的json值
        postData["F_DealDepartMent"] = did;
        postData["F_DealPerson"] = mid;

        alert(JSON.stringify(postData));
        //输出的结果是:{"F_DealDepartMent":"8684502a-5dc2-487c-b589-48d2eb7734c1","F_DealPerson":"feige"}

上一条:php从数据库读取数据,并以json格式返回数据 下一条:json传出的时间戳转化为标准格式

相关文章

最新文章