Use a post callback filter to apply functions such as echo json_encode

not tested... :)