﻿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	querying JSONField in sqlite returns ints for booleans	Matthew Cornell	nobody	"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	new	Database layer (models, ORM)	3.1	Normal		jsonfield querying sqlite		Unreviewed	0	0	0	0	0	0
