Re: unexpected JSONField behavior clarification - key value pairs initially loaded integers, then saved down as strings into the database

2018-05-07 Thread Oliver Zhou
ing you have to watch out for since it can lead to data > loss. > > >>> import json > >>> test = {4: 5, '4': 'a'} > >>> json.loads(json.dumps(test)) > {'4': 5} > > On Apr 24, 2018, at 6:06 PM, Oliver Zhou <oli...@hirevisor.com > > wrote: &

Re: looking for the right way to work with JSONField - behavior inconsistent between strings and integers

2018-05-07 Thread Oliver Zhou
ved from the database. > > Cheers, > Simon > > [0] > https://stackoverflow.com/questions/9304528/why-json-allows-only-string-to-be-a-key#9304820 > > Le mardi 24 avril 2018 20:21:13 UTC-4, Oliver Zhou a écrit : >> >> Using Django 1.11, Python 2.7, PostGres, and J

unexpected JSONField behavior clarification - key value pairs initially loaded integers, then saved down as strings into the database

2018-04-24 Thread Oliver Zhou
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

looking for the right way to work with JSONField - behavior inconsistent between strings and integers

2018-04-24 Thread Oliver Zhou
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