JSON serialization in pgAdmin 4 - Mailing list pgadmin-hackers

From Lele Gaifax
Subject JSON serialization in pgAdmin 4
Date
Msg-id 87mvnauugi.fsf@metapensiero.it
Whole thread Raw
Responses Re: JSON serialization in pgAdmin 4  (Ashesh Vashi <ashesh.vashi@enterprisedb.com>)
List pgadmin-hackers
Hi all,

first of all, let me congratulate with you for how good pgAdmin 4 is quickly
becoming. I tried it now and then, and I'm always surprised by the amount of
effort you spend on it, thank you!

I'd like to know if there is already a plan to properly handle date/timestamp
fields, that currently fail with an error because simplejson by default does
not know how the serialize (or deserialize) those data types.

One minimalistic approach would be subclassing the JSONEncoder and overriding
its default() method. This would solve the serialization problem, but I guess
that sooner or later we may want to support also the other way around.

One further step in that direction could be using nssjson[1] (my fork of
simplejson that supports date/time/datetime/UUID out of the box). I
reimplemented the same functionality on top of python-rapidjson, but the
author didn't accept my PR[2] yet. Rapidjson is much faster on most
operations, but it's also very young...

Thanks in advance,
ciao, lele.

[1] https://pypi.python.org/pypi/nssjson
[2] https://github.com/kenrobbins/python-rapidjson/pull/35
--
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele@metapensiero.it  |                 -- Fortunato Depero, 1929.

pgadmin-hackers by date:

Previous
From: Ashesh Vashi
Date:
Subject: Re: PATCH: To fix issue in removing comments in edit mode (pgAdmin4)
Next
From: Ashesh Vashi
Date:
Subject: Re: JSON serialization in pgAdmin 4