DateTime over JSON

#1

Hi,

I am trying to send DateTime over autobahn, but there's no access to
the json object so I can't add any handlers for more types. I do
believe Date-objects are now standardized in json, so it shouldn't be
controversial to add standard support for it. :slight_smile:

\\ Benjamin

0 Likes

#2

Would the following fit the bill?

class WampServerFactory:

聽聽聽json_encoder_factory = json.JSONEncoder
聽聽聽json_decoder_factory = json.JSONDecoder

same for WampClientFactory. Those would then be used on any protocol
instance from this
factory for encoding/decoding messages.

So you could derive from JSONEncoder/Decoder to implement any custom
marshaling/demarshaling.

路路路

2011/11/5 Benjamin Bruheim <gro...@gmail.com>:

Hi,

I am trying to send DateTime over autobahn, but there's no access to
the json object so I can't add any handlers for more types. I do
believe Date-objects are now standardized in json, so it shouldn't be
controversial to add standard support for it. :slight_smile:

\\ Benjamin

0 Likes

#3

Looks good to me

路路路

On Sat, Nov 5, 2011 at 1:21 PM, Tobias Oberstein <tobias.o...@gmail.com> wrote:

Would the following fit the bill?

class WampServerFactory:

json_encoder_factory = json.JSONEncoder
json_decoder_factory = json.JSONDecoder

same for WampClientFactory. Those would then be used on any protocol
instance from this
factory for encoding/decoding messages.

So you could derive from JSONEncoder/Decoder to implement any custom
marshaling/demarshaling.

2011/11/5 Benjamin Bruheim <gro...@gmail.com>:

Hi,

I am trying to send DateTime over autobahn, but there's no access to
the json object so I can't add any handlers for more types. I do
believe Date-objects are now standardized in json, so it shouldn't be
controversial to add standard support for it. :slight_smile:

\\ Benjamin

0 Likes

#4

2 notes:

datetime does not seem to be included in standard JSON

i've experimented with custom serializer/deserializer for datetime

https://github.com/oberstet/Autobahn/blob/master/test/json/json_datetime.py

there are a couple of non-Autobahn related issues .. pls have a look
into the comments in above.

路路路

2011/11/5 Benjamin Bruheim <gro...@gmail.com>:

Looks good to me

On Sat, Nov 5, 2011 at 1:21 PM, Tobias Oberstein > <tobias.o...@gmail.com> wrote:

Would the following fit the bill?

class WampServerFactory:

json_encoder_factory = json.JSONEncoder
json_decoder_factory = json.JSONDecoder

same for WampClientFactory. Those would then be used on any protocol
instance from this
factory for encoding/decoding messages.

So you could derive from JSONEncoder/Decoder to implement any custom
marshaling/demarshaling.

2011/11/5 Benjamin Bruheim <gro...@gmail.com>:

Hi,

I am trying to send DateTime over autobahn, but there's no access to
the json object so I can't add any handlers for more types. I do
believe Date-objects are now standardized in json, so it shouldn't be
controversial to add standard support for it. :slight_smile:

\\ Benjamin

0 Likes