added ability to save to disk as pretty-printed json.