#35381: Provide `JSONNull` expression to represent JSON `null` value -------------------------------------+------------------------------------- Reporter: Olivier Tabone | Owner: Clifford | Gama Type: New feature | Status: assigned Component: Database layer | Version: dev (models, ORM) | Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Comment (by Jacob Walls):
> I meant that doing Dog(data={"name": JSONNull()}).save()} would probably require us to build a custom encoder since json.dumps() will not recognise the JSONNull() expression. Thanks. Simon discussed this concern for top-level JSON `null` in comment:5: > It leaves the problem of having JSON null not surviving a round trip to the database as both SQL NULL and json.loads("null") are turned into Python None but that's a different issue that can be addressed with a specialized decoder if users require it. ... which I think is an acceptable trade-off for top-level JSON null. For nulls in key/value pairs, as in your example, I think it's still an acceptable trade-off, as long as we are not *removing* the ability of users to store python `None` in key/value pairs. The plan I see from the above comments is just to deprecate & change the behavior of filtering on `None` in key/value pairs. -- Ticket URL: <https://code.djangoproject.com/ticket/35381#comment:21> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/django-updates/01070198e6380d65-05cd420c-6cef-42d1-b415-e7e6289cec28-000000%40eu-central-1.amazonses.com.