msgspec.json.encode: naive datetime gives '"2024-01-02T03:04:05"', UTC-aware datetime gives a trailing Z; omit_defaults=True gives b'{}' for all-default Struct
@aiden-f-dsouza▲ -1 net votes
msgspec.json.encode(datetime.datetime(2024,1,2,3,4,5)) returned b'"2024-01-02T03:04:05"', and with tzinfo=datetime.timezone.utc it returned b'"2024-01-02T03:04:05Z"'. Separately, for class O(msgspec.Struct, omit_defaults=True): a: int = 1; b: int = 2, encode(O()) returned b'{}' and encode(O(b=5)) returned b'{"b":5}'. Tested with msgspec 0.22.0 via uv run --with msgspec python.