diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+1.7.9
+
+* [Build against `aeson-2.0`](https://github.com/dhall-lang/dhall-haskell/pull/2315)
+
 1.7.8
 
 * [Add support for `Date` / `Time` / `TimeZone`](https://github.com/dhall-lang/dhall-haskell/pull/2247)
diff --git a/dhall-json.cabal b/dhall-json.cabal
--- a/dhall-json.cabal
+++ b/dhall-json.cabal
@@ -1,5 +1,5 @@
 Name: dhall-json
-Version: 1.7.8
+Version: 1.7.9
 Cabal-Version: >=1.10
 Build-Type: Simple
 License: BSD3
@@ -38,7 +38,7 @@
     Hs-Source-Dirs: src
     Build-Depends:
         base                      >= 4.11.0.0  && < 5   ,
-        aeson                     >= 1.4.6.0   && < 1.6 ,
+        aeson                     >= 1.4.6.0   && < 2.1 ,
         aeson-pretty                              < 0.9 ,
         aeson-yaml                >= 1.1.0     && < 1.2 ,
         bytestring                                < 0.12,
@@ -48,7 +48,7 @@
         filepath                                  < 1.5 ,
         lens-family-core          >= 1.0.0     && < 2.2 ,
         optparse-applicative      >= 0.14.0.0  && < 0.17,
-        prettyprinter             >= 1.5.1     && < 1.8 ,
+        prettyprinter             >= 1.7.0     && < 1.8 ,
         scientific                >= 0.3.0.0   && < 0.4 ,
         text                      >= 0.11.1.0  && < 1.3 ,
         unordered-containers                      < 0.3 ,
@@ -59,6 +59,7 @@
         Dhall.JSON.Yaml
         Dhall.DhallToYaml.Main
     Other-Modules:
+        Dhall.JSON.Compat
         Dhall.JSON.Util
     GHC-Options: -Wall
     Default-Language: Haskell2010
diff --git a/json-to-dhall/Main.hs b/json-to-dhall/Main.hs
--- a/json-to-dhall/Main.hs
+++ b/json-to-dhall/Main.hs
@@ -15,15 +15,15 @@
 import Options.Applicative (Parser, ParserInfo)
 
 import qualified Control.Exception
-import qualified Data.Aeson                                as Aeson
-import qualified Data.ByteString.Lazy.Char8                as ByteString
+import qualified Data.Aeson                 as Aeson
+import qualified Data.ByteString.Lazy.Char8 as ByteString
 import qualified Dhall.Core
 import qualified Dhall.Util
 import qualified GHC.IO.Encoding
-import qualified Options.Applicative                       as Options
-import qualified Paths_dhall_json                          as Meta
+import qualified Options.Applicative        as Options
+import qualified Paths_dhall_json           as Meta
 import qualified System.Exit
-import qualified System.IO                                 as IO
+import qualified System.IO                  as IO
 
 -- ---------------
 -- Command options
diff --git a/src/Dhall/JSON.hs b/src/Dhall/JSON.hs
--- a/src/Dhall/JSON.hs
+++ b/src/Dhall/JSON.hs
@@ -213,40 +213,40 @@
     , CompileError(..)
     ) where
 
-import Control.Applicative       (empty, (<|>))
-import Control.Exception         (Exception, throwIO)
-import Control.Monad             (guard)
-import Data.Aeson                (ToJSON (..), Value (..))
-import Data.Maybe                (fromMaybe)
-import Data.Text                 (Text)
-import Data.Text.Prettyprint.Doc (Pretty)
-import Data.Void                 (Void)
-import Dhall.Core                (Binding (..), DhallDouble (..), Expr)
-import Dhall.Import              (SemanticCacheMode (..))
-import Dhall.JSON.Util           (pattern FA, pattern V)
-import Dhall.Map                 (Map)
-import Options.Applicative       (Parser)
-import Prelude                   hiding (getContents)
+import Control.Applicative (empty, (<|>))
+import Control.Exception   (Exception, throwIO)
+import Control.Monad       (guard)
+import Data.Aeson          (ToJSON (..), Value (..))
+import Data.Maybe          (fromMaybe)
+import Data.Text           (Text)
+import Data.Void           (Void)
+import Dhall.Core          (Binding (..), DhallDouble (..), Expr)
+import Dhall.Import        (SemanticCacheMode (..))
+import Dhall.JSON.Util     (pattern FA, pattern V)
+import Dhall.Map           (Map)
+import Options.Applicative (Parser)
+import Prelude             hiding (getContents)
+import Prettyprinter       (Pretty)
 
-import qualified Data.Aeson                            as Aeson
-import qualified Data.Foldable                         as Foldable
-import qualified Data.HashMap.Strict                   as HashMap
+import qualified Data.Aeson                as Aeson
+import qualified Data.Foldable             as Foldable
 import qualified Data.List
 import qualified Data.Map
 import qualified Data.Ord
 import qualified Data.Text
-import qualified Data.Text.Prettyprint.Doc.Render.Text as Pretty
-import qualified Data.Vector                           as Vector
-import qualified Dhall.Core                            as Core
+import qualified Data.Vector               as Vector
+import qualified Dhall.Core                as Core
 import qualified Dhall.Import
+import qualified Dhall.JSON.Compat         as JSON.Compat
 import qualified Dhall.Map
 import qualified Dhall.Optics
 import qualified Dhall.Parser
 import qualified Dhall.Pretty
 import qualified Dhall.TypeCheck
 import qualified Dhall.Util
-import qualified Lens.Family                           as Lens
+import qualified Lens.Family               as Lens
 import qualified Options.Applicative
+import qualified Prettyprinter.Render.Text as Pretty
 import qualified System.FilePath
 
 {-| This is the exception type for errors that might arise when translating
@@ -536,7 +536,7 @@
 
                         ys <- traverse inner (Foldable.toList xs)
 
-                        return (Aeson.Object (HashMap.fromList ys))
+                        return (Aeson.Object (JSON.Compat.objectFromList ys))
                     outer (Core.App (Core.Field (V 0) (FA "number")) (Core.DoubleLit (DhallDouble n))) =
                         return (Aeson.toJSON n)
                     outer (Core.App (Core.Field (V 0) (FA "string")) (Core.TextLit (Core.Chunks [] text))) =
@@ -581,7 +581,7 @@
 
                         ys <- traverse inner (Foldable.toList xs)
 
-                        return (Aeson.Object (HashMap.fromList ys))
+                        return (Aeson.Object (JSON.Compat.objectFromList ys))
                     outer (Core.App (Core.Field (V 0) (FA "double")) (Core.DoubleLit (DhallDouble n))) =
                         return (Aeson.toJSON n)
                     outer (Core.App (Core.Field (V 0) (FA "integer")) (Core.IntegerLit n)) =
@@ -635,7 +635,7 @@
 omitNull :: Value -> Value
 omitNull (Object object) = Object fields
   where
-    fields =HashMap.filter (/= Null) (fmap omitNull object)
+    fields = JSON.Compat.filterObject (/= Null) (fmap omitNull object)
 omitNull (Array array) =
     Array (fmap omitNull array)
 omitNull (String string) =
@@ -654,7 +654,7 @@
 omitEmpty (Object object) =
     if null fields then Null else Object fields
   where
-    fields = HashMap.filter (/= Null) (fmap omitEmpty object)
+    fields = JSON.Compat.filterObject (/= Null) (fmap omitEmpty object)
 omitEmpty (Array array) =
     if null elems then Null else Array elems
   where
diff --git a/src/Dhall/JSON/Compat.hs b/src/Dhall/JSON/Compat.hs
new file mode 100644
--- /dev/null
+++ b/src/Dhall/JSON/Compat.hs
@@ -0,0 +1,79 @@
+{-# LANGUAGE CPP #-}
+
+-- | Compatibility helpers for the @aeson-2@ migration.
+module Dhall.JSON.Compat (
+      objectFromList
+    , mapToAscList
+    , filterObject
+    , lookupObject
+    , traverseObjectWithKey
+    , objectKeys
+    , textToKey
+    ) where
+
+import Data.Aeson (Object, Value)
+import Data.Text  (Text)
+
+#if MIN_VERSION_aeson(2,0,0)
+import           Data.Aeson.Key    (Key)
+import qualified Data.Aeson.Key    as Key
+import           Data.Aeson.KeyMap (KeyMap)
+import qualified Data.Aeson.KeyMap as KeyMap
+import           Data.Bifunctor    (first)
+#else
+import           Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap
+import qualified Data.List           as List
+#endif
+
+objectFromList :: [(Text, Value)] -> Object
+#if MIN_VERSION_aeson(2,0,0)
+objectFromList = KeyMap.fromList . map (first Key.fromText)
+#else
+objectFromList = HashMap.fromList
+#endif
+
+filterObject :: (Value -> Bool) -> Object -> Object
+#if MIN_VERSION_aeson(2,0,0)
+filterObject = KeyMap.filter
+#else
+filterObject = HashMap.filter
+#endif
+
+#if MIN_VERSION_aeson(2,0,0)
+mapToAscList :: KeyMap a -> [(Text, a)]
+mapToAscList = map (first Key.toText) . KeyMap.toAscList
+#else
+mapToAscList :: HashMap Text a -> [(Text, a)]
+mapToAscList = List.sortOn fst . HashMap.toList
+#endif
+
+lookupObject :: Text -> Object -> Maybe Value
+#if MIN_VERSION_aeson(2,0,0)
+lookupObject k = KeyMap.lookup (Key.fromText k)
+#else
+lookupObject = HashMap.lookup
+#endif
+
+objectKeys :: Object -> [Text]
+#if MIN_VERSION_aeson(2,0,0)
+objectKeys = map (Key.toText) . KeyMap.keys
+#else
+objectKeys = HashMap.keys
+#endif
+
+#if MIN_VERSION_aeson(2,0,0)
+textToKey :: Text -> Key
+textToKey = Key.fromText
+#else
+textToKey :: Text -> Text
+textToKey = id
+#endif
+
+#if MIN_VERSION_aeson(2,0,0)
+traverseObjectWithKey :: Applicative f => (Key -> v1 -> f v2) -> KeyMap v1 -> f (KeyMap v2)
+traverseObjectWithKey = KeyMap.traverseWithKey
+#else
+traverseObjectWithKey :: Applicative f => (Text -> v1 -> f v2) -> HashMap Text v1 -> f (HashMap Text v2)
+traverseObjectWithKey = HashMap.traverseWithKey
+#endif
diff --git a/src/Dhall/JSONToDhall.hs b/src/Dhall/JSONToDhall.hs
--- a/src/Dhall/JSONToDhall.hs
+++ b/src/Dhall/JSONToDhall.hs
@@ -381,17 +381,15 @@
 import qualified Data.Aeson.Types           as Aeson.Types
 import qualified Data.ByteString.Lazy.Char8 as BSL8
 import qualified Data.Foldable              as Foldable
-import qualified Data.HashMap.Strict        as HM
-import qualified Data.List                  as List
 import qualified Data.Map
 import qualified Data.Map.Merge.Lazy        as Data.Map.Merge
-import qualified Data.Ord                   as Ord
 import qualified Data.Sequence              as Seq
 import qualified Data.String
 import qualified Data.Text                  as Text
 import qualified Data.Vector                as Vector
 import qualified Dhall.Core                 as D
 import qualified Dhall.Import
+import qualified Dhall.JSON.Compat          as JSON.Compat
 import qualified Dhall.Lint                 as Lint
 import qualified Dhall.Map                  as Map
 import qualified Dhall.Optics               as Optics
@@ -519,8 +517,8 @@
 
 keyValMay :: Value -> Maybe (Text, Value)
 keyValMay (Aeson.Object o) = do
-     Aeson.String k <- HM.lookup "key" o
-     v <- HM.lookup "value" o
+     Aeson.String k <- JSON.Compat.lookupObject "key" o
+     v <- JSON.Compat.lookupObject "value" o
      return (k, v)
 keyValMay _ = Nothing
 
@@ -532,7 +530,7 @@
 -}
 inferSchema :: Value -> Schema
 inferSchema (Aeson.Object m) =
-    let convertMap = Data.Map.fromList . HM.toList
+    let convertMap = Data.Map.fromDistinctAscList . JSON.Compat.mapToAscList
 
     in (Record . RecordSchema . convertMap) (fmap inferSchema m)
 inferSchema (Aeson.Array xs) =
@@ -832,13 +830,13 @@
 
     -- object ~> Record
     loop jsonPath (D.Record r) v@(Aeson.Object o)
-        | extraKeys <- HM.keys o \\ Map.keys r
+        | extraKeys <- JSON.Compat.objectKeys o \\ Map.keys r
         , strictRecs && not (null extraKeys)
         = Left (UnhandledKeys extraKeys (D.Record r) v jsonPath)
         | otherwise
         = let f :: Text -> ExprX -> Either CompileError ExprX
-              f k t | Just value <- HM.lookup k o
-                    = loop (Aeson.Types.Key k : jsonPath) t value
+              f k t | Just value <- JSON.Compat.lookupObject k o
+                    = loop (Aeson.Types.Key (JSON.Compat.textToKey k) : jsonPath) t value
                     | App D.Optional t' <- t
                     = Right (App D.None t')
                     | App D.List _ <- t
@@ -853,7 +851,7 @@
         | not noKeyValArr
         , os :: [Value] <- toList a
         , Just kvs <- traverse keyValMay os
-        = loop jsonPath t (Aeson.Object $ HM.fromList kvs)
+        = loop jsonPath t (Aeson.Object $ JSON.Compat.objectFromList kvs)
         | noKeyValArr
         = Left (NoKeyValArray t v)
         | otherwise
@@ -866,7 +864,7 @@
         , Just mapKey   <- D.recordFieldValue <$> Map.lookup "mapKey" r
         , Just mapValue <- D.recordFieldValue <$> Map.lookup "mapValue" r
         = do
-          keyExprMap <- HM.traverseWithKey  (\k child -> loop (Aeson.Types.Key k : jsonPath) mapValue child) o
+          keyExprMap <- JSON.Compat.traverseObjectWithKey (\k child -> loop (Aeson.Types.Key k : jsonPath) mapValue child) o
 
           toKey <-
               case mapKey of
@@ -881,9 +879,9 @@
                   ]
 
           let records =
-                (fmap f . Seq.fromList . List.sort . HM.toList) keyExprMap
+                (fmap f . Seq.fromList . JSON.Compat.mapToAscList) keyExprMap
 
-          let typeAnn = if HM.null o then Just t else Nothing
+          let typeAnn = if null o then Just t else Nothing
 
           return (D.ListLit typeAnn records)
         | noKeyValMap
@@ -972,10 +970,7 @@
                       elements =
                           Seq.fromList
                               (fmap inner
-                                  (List.sortBy
-                                      (Ord.comparing fst)
-                                      (HM.toList o)
-                                  )
+                                  (JSON.Compat.mapToAscList o)
                               )
 
                       elementType
@@ -1061,10 +1056,7 @@
                       elements =
                           Seq.fromList
                               (fmap inner
-                                  (List.sortBy
-                                      (Ord.comparing fst)
-                                      (HM.toList o)
-                                  )
+                                  (JSON.Compat.mapToAscList o)
                               )
 
                       elementType
diff --git a/tasty/Main.hs b/tasty/Main.hs
--- a/tasty/Main.hs
+++ b/tasty/Main.hs
@@ -3,8 +3,8 @@
 
 module Main where
 
-import Data.Void   (Void)
-import Test.Tasty  (TestTree)
+import Data.Void  (Void)
+import Test.Tasty (TestTree)
 
 import qualified Data.Aeson           as Aeson
 import qualified Data.ByteString.Lazy
