﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
32483	QuerySet.values()/values_list() with JSONField returns integers instead of booleans on SQLite.	Matthew Cornell	Mariusz Felisiak	"I have a model with a JSONField:

{{{
class PredictionData(models.Model):
    data = models.JSONField()
}}}

One of the rows contains this dict: {{{{'value': True}}}}.

I'm querying the model's JSON using {{{'data__value'}}}:

{{{
PredictionData.objects.values_list('data', 'data__value')
}}}

I get correct results for postgres (a boolean) but incorrect for sqlite3 (an int). For this query, sqlite3 wrongly returns:

{{{
({'value': True}, 1)
}}}

whereas postgres correctly returns

{{{
({'value': True}, True)
}}}

Same behavior with False/0.


versions:
Python 3.9.1
sqlite3.sqlite_version  # '3.33.0'
django.__version__  # '3.1.7'
"	Bug	closed	Database layer (models, ORM)	3.1	Normal	fixed	jsonfield querying sqlite	sage	Ready for checkin	1	0	0	0	0	0
