Improve readability and line length of to_json.