diff --git a/hw-aeson.cabal b/hw-aeson.cabal
--- a/hw-aeson.cabal
+++ b/hw-aeson.cabal
@@ -1,7 +1,7 @@
 cabal-version: 2.2
 
 name:                   hw-aeson
-version:                0.1.8.0
+version:                0.1.9.0
 synopsis:               Convenience functions for Aeson
 description:            Convenience functions for Aeson.
 category:               Data, JSON
@@ -12,7 +12,7 @@
 copyright:              2018-2022 John Ky
 license:                BSD-3-Clause
 license-file:           LICENSE
-tested-with:            GHC == 9.2.2, GHC == 9.0.2, GHC == 8.10.7, GHC == 8.8.4, GHC == 8.6.5
+tested-with:            GHC == 9.4.4, GHC == 9.2.5, GHC == 9.0.2, GHC == 8.10.7, GHC == 8.8.4, GHC == 8.6.5
 build-type:             Simple
 extra-source-files:     README.md
 
@@ -22,15 +22,15 @@
 
 common base                       { build-depends: base                       >= 4.11       && < 5      }
 
-common aeson                      { build-depends: aeson                      >= 1.4        && < 2.2    }
-common bytestring                 { build-depends: bytestring                 >= 0.10       && < 0.12   }
-common containers                 { build-depends: containers                 >= 0.6        && < 0.7    }
-common doctest                    { build-depends: doctest                    >= 0.16.2     && < 0.21   }
+common aeson                      { build-depends: aeson                      >= 1.4        && < 2.3    }
+common bytestring                 { build-depends: bytestring                 >= 0.10       && < 0.13   }
+common containers                 { build-depends: containers                 >= 0.6        && < 0.8    }
+common doctest                    { build-depends: doctest                    >= 0.16.2     && < 0.23   }
 common doctest-discover           { build-depends: doctest-discover           >= 0.2        && < 0.3    }
 common hashable                   { build-depends: hashable                   >= 1.3        && < 1.5    }
-common hedgehog                   { build-depends: hedgehog                   >= 0.6        && < 1.3    }
+common hedgehog                   { build-depends: hedgehog                   >= 0.6        && < 1.5    }
 common hspec                      { build-depends: hspec                      >= 2.4        && < 3      }
-common text                       { build-depends: text                       >= 1.2        && < 1.3    }
+common text                       { build-depends: text                       >= 1.2        && < 3      }
 common text-short                 { build-depends: text-short                 >= 0.1.3      && < 0.2    }
 common unordered-containers       { build-depends: unordered-containers       >= 0.2        && < 0.3    }
 
diff --git a/src/HaskellWorks/Data/Aeson.hs b/src/HaskellWorks/Data/Aeson.hs
--- a/src/HaskellWorks/Data/Aeson.hs
+++ b/src/HaskellWorks/Data/Aeson.hs
@@ -1,5 +1,10 @@
+{-# LANGUAGE CPP #-}
 {-# LANGUAGE DerivingVia #-}
-
+#if MIN_VERSION_aeson(2,2,0)
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE UndecidableInstances #-}
+#endif
 module HaskellWorks.Data.Aeson
     ( JsonEndo(..)
     , WithJsonKeyValues(..)
@@ -30,8 +35,13 @@
   }
   deriving (Semigroup, Monoid) via (Endo [a])
 
+#if MIN_VERSION_aeson(2,2,0)
+instance (ToJSON e, KeyValue e a) => KeyValue e (JsonEndo a) where
+  explicitToField f k v = JsonEndo (k .= f v :)
+#else
 instance KeyValue a => KeyValue (JsonEndo a) where
-  k .= v = JsonEndo (k .= v:)
+#endif
+  k .= v = JsonEndo (k .= v :)
 
 objectWithoutNulls :: [Pair] -> Value
 objectWithoutNulls = object . Prelude.filter (not . isNull . snd)
@@ -45,13 +55,21 @@
   Nothing -> fail $ "Could not parse " <> t
 
 -- | Render optional fields as missing in JSON output.
+#if MIN_VERSION_aeson(2,2,0)
+(.?=) :: (KeyValue e p, ToJSON v, Monoid p) => Key -> Maybe v -> p
+#else
 (.?=) :: (KeyValue p, ToJSON v, Monoid p) => Key -> Maybe v -> p
+#endif
 (.?=) k mv = case mv of
   Just v -> k .= v
   Nothing -> mempty
 
 -- | Same as '.=', but with lower precedence to work well with lens.
+#if MIN_VERSION_aeson(2,2,0)
+(.!=) :: (KeyValue e kv, ToJSON v) => Key -> v -> kv
+#else
 (.!=) :: (KeyValue kv, ToJSON v) => Key -> v -> kv
+#endif
 (.!=) = (.=)
 
 -- | Same as 'object' except used in combination with '.?=' and '.!=' instead of '.='.
@@ -81,7 +99,11 @@
 --     ]
 -- @
 class ToJsonKeyValues a where
+#if MIN_VERSION_aeson(2,2,0)
+  toJsonKeyValues :: (KeyValue e kv, Monoid kv) => a -> [kv]
+#else
   toJsonKeyValues :: (KeyValue kv, Monoid kv) => a -> [kv]
+#endif
 
 -- | For use with language extension DerivingVia.  This derivation provides
 -- a ToJSON instance that delegates to the ToJsonKeyValues instance.
