Skip to content

Create to_dict function #92773

Closed
Closed
@pvgmenegasso

Description

@pvgmenegasso

Create to_dict function

With Python built-in methods and attributes for classes it is possible to automatically translate a custom class
to a Dict object, which can be subsequently used when serializing data.

Pitch

I Have implemented this feature in a non related project which relies on python in order to be
able to serialize my custom and nested classes in jsonl format.

I plan to add it to json module... Nonetheless I am open to suggestions/comments

Here is an example of this feature in action:

image
Here we convert an object to jsonl format and write it in disk.
image
image

This is an example of how the feature could be used

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions