@@ -46,14 +46,6 @@ import GHC.TypeLits
4646import qualified Optics.Lens as OL
4747import Unsafe.Coerce
4848import Prelude
49−#if MIN_VERSION_aeson(2,0,0)
50−import Data.Aeson.Key (fromText, fromString)
51−#else
52−fromText :: a -> a
53−fromText = id
54−fromString :: String -> T.Text
55−fromString = T.pack
56−#endif
5749
5850-- | Field named @l@ labels value of type @t@ adapted from the awesome /labels/ package.
5951-- Example: @(#name := \"Chris\") :: (\"name\" := String)@
@@ -566,16 +558,16 @@ class ToJSON a => EncodeField a where
566558
567559instance ToJSON a => EncodeField a where
568560 encodeField = pure . toJSON
569− encodeKV k v = fromText k .= v
561+ encodeKV = (.=)
570562
571563instance {-# OVERLAPS #-} ToJSON a => EncodeField (Maybe a) where
572564 encodeField = fmap toJSON
573565 encodeKV _ Nothing = mempty
574− encodeKV k v = fromText k .= v
566+ encodeKV k v = k .= v
575567
576568recToValue :: forall lts. (RecApply lts lts EncodeField) => JSONOptions -> Rec lts -> Value
577569recToValue options r =
578− object $ catMaybes $ reflectRec @EncodeField Proxy (\k v -> (fromString (fieldTransform options k),) <$> encodeField v) r
570+ object $ catMaybes $ reflectRec @EncodeField Proxy (\k v -> (T.pack (fieldTransform options k),) <$> encodeField v) r
579571
580572recToEncoding :: forall lts. (RecApply lts lts EncodeField) => JSONOptions -> Rec lts -> Encoding
581573recToEncoding options r =
@@ -680,10 +672,10 @@ class FromJSON a => ParseField a where
680672 parseField :: Object -> T.Text -> Parser a
681673
682674instance FromJSON a => ParseField a where
683− parseField o k = o .: fromText k
675+ parseField = (.:)
684676
685677instance {-# OVERLAPS #-} FromJSON a => ParseField (Maybe a) where
686− parseField o k = o .:? fromText k
678+ parseField = (.:?)
687679
688680instance
689681 ( KnownSymbol l,