Alternatively or objects inside the array value is not replaced variable name

// Replace variable names or objects inside the array does not replace the value 
        // define a variable 
        var jsonObj;
         // variables which we desired object or array 
        jsonObj = {code: "200" , name: "300", sex : "400" };
         // this is the code attributes directly into Supercode 
        // the JSON.parse () is used to convert a JSON string object 
        // the JSON.stringify () is converted into a string json 
        jsonObj = JSON .parse (JSON.stringify (jsonObj) .replace ( 'code', 'superCode'))

 

Guess you like

Origin www.cnblogs.com/blueswithchenxing/p/11433131.html