added pretty print to to_json