{"id":23062023,"url":"https://github.com/mbachry/alljson","last_synced_at":"2026-05-03T02:39:24.688Z","repository":{"id":57409834,"uuid":"119273801","full_name":"mbachry/alljson","owner":"mbachry","description":"Make any type JSON-serializable","archived":false,"fork":false,"pushed_at":"2018-01-28T17:39:03.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-09T00:48:12.759Z","etag":null,"topics":["json","python","serialization"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mbachry.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-28T16:06:00.000Z","updated_at":"2018-05-07T10:15:55.000Z","dependencies_parsed_at":"2022-08-24T20:00:19.158Z","dependency_job_id":null,"html_url":"https://github.com/mbachry/alljson","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbachry%2Falljson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbachry%2Falljson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbachry%2Falljson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbachry%2Falljson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mbachry","download_url":"https://codeload.github.com/mbachry/alljson/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246952478,"owners_count":20859844,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["json","python","serialization"],"created_at":"2024-12-16T03:19:38.576Z","updated_at":"2026-05-03T02:39:24.661Z","avatar_url":"https://github.com/mbachry.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"alljson\n=======\n\n.. image:: https://travis-ci.org/mbachry/alljson.svg?branch=master\n    :alt: Build status\n    :target: https://travis-ci.org/mbachry/alljson\n\nMake any type JSON-serializable.\n\nA Python module which makes ``json.dumps`` work with several builtin\nand stdlib types. A hook for registering any custom type is also\nprovided.\n\nInstalling\n----------\n\nSimply install ``alljson`` with pip or add it to your project dependencies::\n\n    pip install alljson\n\nSupported types\n---------------\n\nAfter installing, the following types are JSON-serializable:\n\n* generators\n\n* ``set`` and ``frozenset``\n\n* ``dict`` item/key/value iterators and views\n\n* ``datetime.date`` and ``datetime.datetime`` (as strings in ISO format)\n\n* ``uuid.UUID``\n\n* ``decimal.Decimal`` (serialized as string in order to preserve precision)\n\n* ``reversed`` results\n\nIn addition to these, the following Python 3 types are supported:\n\n* ``map``, ``filter``, ``range`` iterators\n\n* ``enum.Enum``\n\n* ``pathlib.Path``\n\n* ``types.MappingProxyType``\n\n* classes implementing ``Sequence`` and ``Mapping`` abc interfaces\n\nRegistering custom types\n------------------------\n\nIn order to register a new type, use ``alljson.register_encoder(type,\nencoder_function)``. ``encoder_function`` should take object of given\ntype as the only parameter and return a simple JSON-serializable\nPython value (such as ``dict`` or ``str``).\n\nFor example::\n\n    import arrow\n    import alljson\n\n    alljson.register_encoder(arrow.Arrow, arrow.Arrow.isoformat)\n\nAcknowledgements\n----------------\n\n* pth trick was stolen from delightful `future-fstrings`_ project\n\n.. _future-fstrings: https://github.com/asottile/future-fstrings\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbachry%2Falljson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmbachry%2Falljson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbachry%2Falljson/lists"}