Thanks for the clarification -> although it seems like it should actually
raise a warning or exception to prevent non-deterministic data errors when
people aren't aware.
Oliver
On Tuesday, April 24, 2018 at 8:20:53 PM UTC-7, Simon Charette wrote:
>
> Hello Olivier,
>
> Since JSON objects can
Hello Olivier,
Since JSON objects can only have string keys[0] I'd suggest you always use
strings
as dict keys on the Python side to avoid having to deal with both cases.
Another solution would to subclass JSONField to override the from_db_value
method
to turn keys into integer when retrieved
Using Django 1.11, Python 2.7, PostGres, and JSONField I'm getting behavior
I don't expect.
It seems when JSONField values are initially saved/accessed in memory,
they're python "integers", but when saved to the database and then
re-accessed, the values are now in string format.
*What about
3 matches
Mail list logo