@@ -1676,24 +1676,41 @@ instance ToJSON Day where
16761676 toJSON = stringEncoding . E.day
16771677 toEncoding = E.day
16781678
1679+instance ToJSONKey Day where
1680+ toJSONKey = toJSONKeyTextEnc E.day
1681+
16791682
16801683instance ToJSON TimeOfDay where
16811684 toJSON = stringEncoding . E.timeOfDay
16821685 toEncoding = E.timeOfDay
16831686
1687+instance ToJSONKey TimeOfDay where
1688+ toJSONKey = toJSONKeyTextEnc E.timeOfDay
1689+
16841690
16851691instance ToJSON LocalTime where
16861692 toJSON = stringEncoding . E.localTime
16871693 toEncoding = E.localTime
16881694
1695+instance ToJSONKey LocalTime where
1696+ toJSONKey = toJSONKeyTextEnc E.localTime
1697+
1698+
16891699instance ToJSON ZonedTime where
16901700 toJSON = stringEncoding . E.zonedTime
16911701 toEncoding = E.zonedTime
16921702
1703+instance ToJSONKey ZonedTime where
1704+ toJSONKey = toJSONKeyTextEnc E.zonedTime
1705+
1706+
16931707instance ToJSON UTCTime where
16941708 toJSON = stringEncoding . E.utcTime
16951709 toEncoding = E.utcTime
16961710
1711+instance ToJSONKey UTCTime where
1712+ toJSONKey = toJSONKeyTextEnc E.utcTime
1713+
16971714-- | Encode something t a JSON string.
16981715stringEncoding :: Encoding -> Value
16991716stringEncoding = String