{"id":22308775,"url":"https://github.com/ratson/dj-jsonfield","last_synced_at":"2025-07-19T06:32:22.525Z","repository":{"id":57422817,"uuid":"71153867","full_name":"ratson/dj-jsonfield","owner":"ratson","description":"JSONField for django models","archived":false,"fork":false,"pushed_at":"2016-10-17T16:11:40.000Z","size":431,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-05T06:38:37.190Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pypi.python.org/pypi/dj-jsonfield","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ratson.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":"2016-10-17T15:37:06.000Z","updated_at":"2016-10-17T16:04:42.000Z","dependencies_parsed_at":"2022-09-12T15:43:41.536Z","dependency_job_id":null,"html_url":"https://github.com/ratson/dj-jsonfield","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ratson/dj-jsonfield","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ratson%2Fdj-jsonfield","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ratson%2Fdj-jsonfield/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ratson%2Fdj-jsonfield/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ratson%2Fdj-jsonfield/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ratson","download_url":"https://codeload.github.com/ratson/dj-jsonfield/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ratson%2Fdj-jsonfield/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265898254,"owners_count":23845758,"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":[],"created_at":"2024-12-03T20:15:15.137Z","updated_at":"2025-07-19T06:32:22.298Z","avatar_url":"https://github.com/ratson.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"dj-jsonfield\n===================\n\nThis is a fork of `django-jsonfield`_.\n\nWhy fork\n--------\n\nI need to use `django-jsonfield`_ with `jsonfield`_.\nUnfortunately, both have been using the same package name ``jsonfield``,\nso I have to maintain a fork.\n\nDifference from upstream\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\n- Rename package name from ``jsonfield`` to ``dj_jsonfield``.\n\n.. _django-jsonfield: https://bitbucket.org/schinckel/django-jsonfield\n.. _jsonfield: https://github.com/bradjasper/django-jsonfield/\n\nIntroduction\n------------\n\nI had a serious need for a JSON field for django. There were a couple out\nthere, but none packaged up nicely on bitbucket/github that were usable\nwith ``pip install -e``.\n\nSo I took the code from `David Cramer's blog`_, and packaged it up.\n\nUsage\n-----\n\nTo use, just install the package, and then use the field::\n\n    from django.db import models\n    import dj_jsonfield\n\n    class MyModel(models.Model):\n        the_json = dj_jsonfield.JSONField()\n\nYou can assign any JSON-encodable object to this field. It will be\nJSON-encoded before being stored in the database as a text value and it\nwill be turned back into a python list/dict/string upon retrieval from the\ndatabase.\n\nThere is also a ``TypedJSONField``, that allows you to define data types that must be included within each object in the array. More documentation to follow.\n\n\nNotes\n~~~~~\n\nIf no ``default`` is provided, and ``null=True`` is not passed in to the\nfield constructor, then a default of ``{}`` will be used.\n\n\nSupported django versions\n-------------------------\n\nAll versions of Django from 1.8 onwards are tested, however, if you are using Postgres, I highly recommend that you consider using the ``django.contrib.postgres`` module's ``JSONField`` instead.\n\nExtras\n------\n\njsonify templatetag\n~~~~~~~~~~~~~~~~~~~\nThis allows you to convert a python data structure into JSON within a template::\n\n    {% load jsonify %}\n\n    \u003cscript\u003e\n    var foo = {{ bar|jsonify|safe }};\n    \u003c/script\u003e\n\nNote that you must only use the \"safe\" filter when you use the jsonify\nfilter within a \u003cscript\u003e tag (which is parsed like a CDATA section).\n\nIf you use it in some other places like in an HTML attribute, then\nyou must not use the safe filter so that its output is properly escaped::\n\n    \u003cdiv data-foo=\"{{ bar|jsonify }}\"\u003e\n\nThe above rules are important to avoid XSS attacks with unsafe strings\nstored in the converted data structure.\n\nTodo\n----------\nAllow for passing in a function to use for processing unknown data types.\n\nConvert date/time objects nicely to/from ISO strings (YYYY-mm-dd HH:MM:SS\nTZNAME). This is actually a bit tricky, as we don't know if we are expecting\na date/time object. We may parse objects as we go, but there could be\nsome performance issues with this. I'm tempted to say \"only do this on TypedJSONField()\"\n\n`History \u003chttps://bitbucket.org/schinckel/django-jsonfield#rst-header-history\u003e`_\n\n.. _David Cramer's blog: http://justcramer.com/2009/04/14/cleaning-up-with-json-and-sql/\n.. _IanLewis: https://bitbucket.org/IanLewis\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fratson%2Fdj-jsonfield","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fratson%2Fdj-jsonfield","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fratson%2Fdj-jsonfield/lists"}