make it work more like as_json()