Skip to content

LazyObject in dictionaries don't serialize #16

Description

@con-f-use

image

@scopatz @gforsyth

json.dumps({"key": LazyObject(lambda: "nope", {}, 'lo')})  # TypeError: Object of type str is not JSON serializable

Gives the confusing (pun) error message of TypeError: Object of type str is not JSON serializable. Yes it is, Mr. Python, Sir!

Not sure but maybe the __hash__ method must be passed through or something. One might think about pickle and __get_state__, too.

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