Replaced __dict__ with to_json