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 something 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 a new key value that combines both.
JSON goes dynamically with a key label, and the value is not static, it can be anything. For example, [{"name":"srinivas","lastname":"pai"}]
source share