Add an as_json method so pretty-printed JSON opts can be applied