Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

excluding a attribute from json strigify

function replacer(key,value)
{
    if (key=="privateProperty1") return undefined;
    else if (key=="privateProperty2") return undefined;
    else return value;
}

var x = {
    x:0,
    y:0,
    divID:"xyz",
    privateProperty1: 'foo',
    privateProperty2: 'bar'
};

alert(JSON.stringify(x, replacer));
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #excluding #attribute #json #strigify
ADD COMMENT
Topic
Name
7+3 =