Linked Questions
76 questions linked to/from How can I overcome "datetime.datetime not JSON serializable"?
0 votes
2 answers
13k views
Python json TypeError: Object of type Decimal is not JSON serializable
I did check a lot of different related Q'n'A (see linked questions), but none adressed my specific problem, mostly it was about different datatypes or requirements. The attempt is to use this snippet ...
0 votes
4 answers
4k views
Flask datetime.date is not JSON serializable
I am trying to return return a list of dictionaries as part of a get request. I'm calling the function below. def get_data(id): selected_data = Database.get_date(id) json.dumps(selected_data, ...
0 votes
2 answers
3k views
Python AWS function failing to return ELB data through Lambda - works on console
This should be simple so I'm hoping some can help with this quite quickly. I have the following basic python script: import boto3 elb = boto3.client('elb') print(elb.describe_load_balancers()) When ...
5 votes
2 answers
2k views
Bottle framework: how to return datetime in JSON response
When I try to return JSON containing datetime value, I'm getting File "/usr/lib/python2.7/json/encoder.py", line 178, in default raise TypeError(repr(o) + " is not JSON serializable") TypeError:...
2 votes
2 answers
3k views
How to export pandas dataframe into json and retain original datetime format?
I am working on a dataset and I applied to_json() method to export a pandas dataframe in a json file. I will then use this json file to upload to MongoDB. However I realise that the datetime format ...
3 votes
2 answers
2k views
HTML/Chart JS deserialize JSON from Python Flask
I am trying to return an object to a Chart JS application. The data was initially from a dataframe in pandas. So this was the original object generated. {'datasets': [{'label': 'Door_08', 'data': [{'...
1 vote
1 answer
3k views
dump dictionary with datetime key to json file generating TypeError
I created a dictionary and was trying to dump it as a json file, but had problems due to the type of the key being a datetime. In my researches I found solutions for the values but not for the keys. ...
1 vote
2 answers
3k views
Redis : is it possible to share datetimes directly between php/laravel and python?
I'm using Redis (phpredis) to share data between my Laravel and my Python app. Within Laravel, I save on a specific channel my array: $data = MyModel::where('start_date','>', "2018-05-02 10:00:00"...
0 votes
1 answer
3k views
SQlAlchemy: Could not determine join condition between parent/child tables on relationship error message
I've recently used sqlacodegen When I try and run against the generated code it get this message that I've been unable to fix: Could not determine join condition between parent/child tables on ...
1 vote
0 answers
3k views
AWS cloudformation python not JSON serializable Error
Im using AWS lambda(using python 2.7) to invoke StackResource api to get the Stack Id of the resource created as part of nested stack .Im getting below error "An error occurred during JSON ...
0 votes
1 answer
2k views
TypeError: Object of type 'time' is not JSON serializable
My dataset looks like following. Using altair for visualization. I am trying to plot timeseries plot such that my time is on X axis and pickups are on y-axis and color represents day of the week. My ...
0 votes
1 answer
1k views
Flask and handeling a Zeep response with datetime
I'm calling a SOAP WebService using Zeep, and it returns a JSON-like response with a datetime object. I want to write a micro-service using Flask and return proper JSON response. However, Flask ...
2 votes
1 answer
2k views
How to convert cqlengine resultset objects into JSON format
I am writing an API which queries a Cassandra 2.1.2 based database and returns results in JSON format. I am using cqlengine for this. Here is the simplified schema - class Checkins(Model): ...
0 votes
1 answer
2k views
datetime.datetime(2018, 3, 8, 10, 29, 49, 178285) is not JSON serializable in python with psycopg2
I have created in postgresql a table, using the code below : create table spyResults (id serial not null primary key, info jsonb not null); Now, in Python I want to insert the data into that table. I'...
0 votes
2 answers
1k views
json: TypeError: '<li>...spam...</li>' is not JSON serializable
Within the following class I am trying to save some state information to a json file, however when I attempt to save a dictionary I come across a TypeError: '<li>...stuff...</li>' is not ...