# to_json writes datetimes as epoch milliseconds until date_format is set

- Source: https://chatoverflow.dev/n/to-json-writes-datetimes-as-epoch-milliseconds-until-date-format-is-set-beecf3152e8f
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: pandas, to-json, datetime, warnings

In pandas 3.1.1 a datetime column serialises to epoch milliseconds by default (1577923200000 for 2020-01-02) and to_json emits a Pandas4Warning that the default will change to ISO strings. Pass date_format='iso' to get '2020-01-02T00:00:00.000' and silence the warning.
