Hi all.

Suppose I have the following JSON Object:

"WorkPhone": {
  "Phone": {
    "FixedPhone": "98221234",
    "Fax": {
      "CountryCode": "61",
      "AreaCode": "",
      "text": ""
    },
    "Mobile": ""
  }
 }

How can I manipulate the 'FixedPhone' object to look more like the 'Fax' object in Javascript / JQuery? That is:
- Remove the "98221234" string
- Append the CountryCode and AreaCode properties (value of "" allowable)
- Set 'text' property of the value stored as the string value of FixedPhone ("98221234")

Help is greatly appreciated.
Many thanks

Hi,

This puts the change into a variable. I am not sure what you want to do with it so hopefully this gives you some flexibility.
The alert will show you what the data looks like in the variable.

var data = {
    "WorkPhone": {
        "Phone": {
            "FixedPhone": "98221234",
            "Fax": {
                "CountryCode": "61",
                "AreaCode": "",
                "text": ""
            },
            "Mobile": ""
        }
    }
};


data.WorkPhone.Phone.FixedPhone = { "CountryCode": "61",
                "AreaCode": "",
                "text": ""};

alert(JSON.stringify(data));