>> #o = json.loads(value)
>> o = simplejson.loads(value, use_decimal = True)
>
> I think this should be dependent on the Python version and use either
> the builtin module or simplejson where not available. The loads
> function should be probably exposed to the customer for better
> customization of the result. So, all in all, I think psycopg should
Yes, absolutely right. To allow serialization of decimal, datetime and
even custom classes ..
>> return o
>> except:
>> raise InterfaceError("bad JSON representation: %r" % value)
>
> Probably should be DataError. Not sure it is the case to dump the
> entire value into the exception: it may be huge.
I agree. Default should be no dumping. I guess it's a very unlikey
case anyway, since when PG is handling it as JSON, it _is_ probably
a JSON ..