use json_encode for any write.response