-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add custom encoding to dump/dumps. (#88)
Add support for custom encoders (and bump version to 0.10.0). This change reimplements `dump()` and `dumps()` on top of a `JSON5Encoder` class that can be subclassed to customize the encoding of a data structure. The new class is somewhat similar to the `JSONEncoder` class in the standard library, except that in addition to a `default()` method that you can define to say how to encode an object that the normal encoder can't handle, there's also an `encode()` method that you can override to customize how existing data types are handled. The change also adds a `quote_style` argument that can be used to customize how strings are encoded (whether to use double or single quotes by default, etc.).
- Loading branch information
Showing
14 changed files
with
1,040 additions
and
742 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.