removePropertyFromJSON(propertyName: String, json: Object);
propertyName. Object property to remove.
json. Source object.
The removePropertyFromJSON method removes specified property from JSON object.
To execute the example, add a link to PP.js scenario file to HTML page. Create a JSON object and remove one of its three properties:
// Create a source object var chart = { chartType: "pie", editMode: 0, options: "selected" }; var getProperties = function (obj) { // Output the list of object properties' values var result = ""; for (var i in obj) { result += obj[i]; result += " " }; return result; } console.log("Source object properties' values: " + this.getProperties(chart)); // Remove the chartType propert from the object PP.removePropertyFromJSON("chartType", chart); console.log("Changed object properties' values: " + this.getProperties(chart));
After executing the example the browser console displays a list of created object properties before and after the chartType field set to "pie" is deleted:
Values of source object properties: pie 0 selected
Values of changed object properties: 0 selected
See also: