#32203: Error with values with JSON path lookup in Sqlite when value is numeric. -------------------------------------+------------------------------------- Reporter: Gordon Wrigley | Owner: sage Type: Bug | Status: assigned Component: Database layer | Version: 3.1 (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 -------------------------------------+------------------------------------- Changes (by sage):
* owner: nobody => sage * status: new => assigned * type: Uncategorized => Bug * component: Uncategorized => Database layer (models, ORM) * stage: Unreviewed => Accepted Comment: This is because SQLite's `JSON_EXTRACT` returns deserialized values. A simple solution is just to add `TypeError` [https://github.com/django/django/blob/master/django/db/models/fields/json.py#L80 here], which will also partially "solve" problems with people who use the JSON data type on PostgreSQL. Another option is to wrap the value in `JSON_QUOTE`... which I think is the better option. I'm guessing there's also a bug in querying `__key` on `{"key": "\"value\""}`, which will return `value` rather than `"value"`. I ''think'' wrapping the value in `JSON_QUOTE` should fix this as well. -- Ticket URL: <https://code.djangoproject.com/ticket/32203#comment:3> 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 on the web visit https://groups.google.com/d/msgid/django-updates/065.04c8f32a33d269888b36685dfedc3917%40djangoproject.com.