Skip to content
This repository was archived by the owner on Mar 18, 2019. It is now read-only.
This repository was archived by the owner on Mar 18, 2019. It is now read-only.

TypeError datetime.date(2017, 3, 28) is not JSON serializable #133

@gabn88

Description

@gabn88

On line 335 of corejson.py json.dumps is called which causes this error.

/lib/python3.5/site-packages/coreapi/codecs/corejson.py in encode
                    return force_bytes(json.dumps(data, **kwargs)) 

Using DRF I wanted to use coreapi to create the schemes, however when rendering the view I get this error. In DRF this is solved by using a custom JSONEncoder (which subclasses json.JSONEncoder), in rest_framework.utils.encoders... It might be a good idea to include the custom encoder also in this package, what do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions