js对json增删改查操作

 <script type="text/javascript">
        Array.prototype.clear = function() {
            this.length = 0;
        }
        Array.prototype.insertAt = function(index, obj) {
            this.splice(index, 0, obj);
        }
        Array.prototype.remove = function(index) {
            this.splice(index, 1);
        }


        var t = [{ 'a': {'c':22}, 'b': 2 }, { 'a': 2}];
        t.push({ 'a': 3 }); //增
        //t[0].a = 11; //改
        //t.remove(0); //删
        alert(t[0].a.c);
    </script>

原文地址:https://www.cnblogs.com/aaa6818162/p/1977210.html