switch out the json encode for the php version