I am generating json from an array using json_encode() , it works correctly, but it uses the key: value from the array, as usual. but I want to change the key name only in json output .. is it possible to do this? or should I prepare the json key: values myself manually?
Example:
$arr = array ('a'=>1,'b'=>2,'c'=>3,'d'=>4,'e'=>5); echo json_encode($arr);
O / p
{"a":1,"b":2,"c":3,"d":4,"e":5}
I want.
{"foo":1,"something":2,"bar":3,"foo":4,"baz":5}
edit: I cannot edit the original array .. (generated using framweork)
Vamsi source share