JSONField not accepting string values
Describe the bug
JSONField should be a generic field that accepts anything that can be "stringfied" to json, and that string be loaded back to their original values.
Currently, trying to pass a string to JSONField makes it try to decode it first, which raises an error saying that the value is not a valid json value.
To Reproduce
Try to set any JSONField to any string, like "foobar"
Expected behavior
The expected behaviour would be that any serializable value would be JSON stringified and then be converted back. E.g, using the json module:
In [1]: import json
In [2]: json.dumps("foobar")
Out[2]: '"foobar"'
In [3]: json.loads('"foobar"')
Out[3]: 'foobar'
In [4]: json.dumps(123)
Out[4]: '123'
In [5]: json.loads('123')
Out[5]: 123
More specifically, if I set a string on it, I expect a string back. If I pass an int to it, I expect an int back. If I pass some dict to it, I expect that dict back, as long as the encoder/decoder can encode/decode those attributes.
This is also the way most JSONField works, like django's.