Wednesday, February 11, 2015

JAVA SCRIPT HOW TO ADD FUNCTION INTO JSON OBJECT

var beanPropertyArray = [];

columnData = {
    "1": "One", 
     "2": "Two", 
    "myFun": function ( ) {
                                            return 1*2;
                                 }

beanPropertyArray.push(columnData);

Noyr : now direct use the beanPropertyArray as a JSON object it will give you the function in the json data. Do NOT use JSON.stringify(beanPropertyArray).


No comments:

Post a Comment

Scrum and Scrum master

Scrum  Scrum is a framework which helps a team to work together.  It is like a rugby team (the scrum name comes from rugby game). Scrum enco...