My last comment might be confusing. I meant that you should let the `encoder` class (the `json.dump` `cls` argument) default to `None`.