You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TypeError: Object of type datetime is not JSON serializable
The RunExecutionResult has a generated_at field of type datetime.datetime, and in fastapi 0.68.1 it is not supported to serialize datetime.datetime to json.
Update fastapi to the latest release (0.86.0) will solve this problem.
The text was updated successfully, but these errors were encountered:
Yeah, more specifically, this version of fastapi doesn't properly handle serialization of nested properties in dataclasses. Looks like it was fixed in 0.81.0.
If changing the version is not possible, another workaround would be to explicitly call dataclasses.asdict on the results or similarly call jsonable_encoder twice.
hello! apologies for the slow response here. there should be fixed in a future release -- we've fixed this in our own testing internally either with the solution above or similarly json_encoder(results.to_dict())
that /run endpoint is not officially supported yet (perhaps despite clear documentation) -- stay tuned for that and more soon!
POST to /run returns Internal Server Error:
The
RunExecutionResult
has agenerated_at
field of typedatetime.datetime
, and in fastapi 0.68.1 it is not supported to serializedatetime.datetime
to json.Update fastapi to the latest release (0.86.0) will solve this problem.
The text was updated successfully, but these errors were encountered: