I have this sample JSON object
var sample = [{ "label": "one", "value": 1 }, { "label": "two", "value": 2 }, { "label": "three", "value": 3 }, { "label": "four", "value": 4 }, { "label": "five", "value": 5 }]; I want to change it some thing like this
var sample = [{ "label": "one", "value": 1, "newKeyValue": "one|1" }, { "label": "two", "value": 2, "newKeyValue": "two|2" }, { "label": "three", "value": 3, "newKeyValue": "three|3" }, ... ]; It should combine both key values and return new key value combining both.
JSON is coming dynamically key label and value are not static it can be anything. For example [{"name":"srinivas","lastname":"pai"}]
$.extend(targetSample,Sample);