<s> import json <EOL> import datetime <EOL> class DateEncoder ( json . JSONEncoder ) : <EOL> def default ( self , obj ) : <EOL> if isinstance ( obj , ( datetime . date , datetime . datetime ) ) : <EOL> return obj . replace ( microsecond = <NUM_LIT:0> ) . strftime ( '<STR_LIT>' ) + "<STR_LIT>" % ( obj . microsecond // <NUM_LIT:1000> ) <EOL> else : <EOL> return json . JSONEncoder . default ( self , obj ) </s>
