trying out custom json_encode() fxn for <php5.2