derek-schaefer / django-json-field

Generic JSON model and form fields.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Decoding/encoding time/date/datetime should be optional, if not disabled by default.

fletom opened this issue · comments

That feature, while interesting, isn't necessary for most applications.

It's also, by my admittedly inexact measurement, over three times slower:

In [25]: %timeit json.loads(s)
10000 loops, best of 3: 30.8 us per loop

In [26]: %timeit json.loads(s, cls = JSONDecoder)
10000 loops, best of 3: 100 us per loop

Yes it's definitely slower, I get similar results. However, there is a way to disable the custom deserializer:

json = JSONField(decoder=None)

Regarding disabling it by default, I'm not sure about that yet. Most importantly it would break backwards compatibility, so I'm going to leave it as is for now.