REST framework API through Object of type datetime is not JSON serializable error with auth.backends.RemoteUserBackend

2020-11-12 Thread 'bala' via Django users
Hi All,migrating existing piston based Django api to REST framework api, it works in dev environment but once moved to QA with  django.contrib.auth.backends.RemoteUserBackend enabled in settings, getting the following error raise TypeError(f'Object of type {o.__class__.__name__} 'TypeError: Objec

Re: JSON serializable error

2018-08-03 Thread Christophe Pettus
> On Aug 3, 2018, at 07:18, Anusha Kommineni > wrote: > TypeError: datetime.datetime(2018, 2, 12, 0, 0, tzinfo=) is not JSON > serializable The error means what it says; there is no default way of serializing a datetime into JSON. You can use the DjangoJSONEncoder, which does allow serializ

Re: JSON serializable error

2018-08-03 Thread vineeth sagar
You can use unix timestamp, It's json serializable and can be converted to a datetime object. If I am not wrong you were trying to store it in a session? try this. import time timestamp=time.time() request.session['current time']= timestamp import datetime datetime.datetime.fromtimestamp(request

Re: JSON serializable error

2018-08-03 Thread Julio Biason
Hi Anusha, It seems you're trying to generate a JSON of some object/dictionary with a Datetime in it. Datetimes are not serializable 'cause there is no date/time representation in JSON (maybe epoch, but that's not the default). On Fri, Aug 3, 2018 at 11:18 AM, Anusha Kommineni < anushakommineni..

JSON serializable error

2018-08-03 Thread Anusha Kommineni
Hi, I am getting below error.Can anyone help me? TypeError: datetime.datetime(2018, 2, 12, 0, 0, tzinfo=) is not JSON serializable -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails fro