@@ -112,10 +112,11 @@ module Database.PostgreSQL.Simple.FromField
112112
113113#include "MachDeps.h"
114114
115−import Control.Applicative ( (<|>), (<$>), pure, (*>) )
115+import Control.Applicative ( (<|>), (<$>), pure, (*>), (<*) )
116116import Control.Concurrent.MVar (MVar, newMVar)
117117import Control.Exception (Exception)
118118import qualified Data.Aeson as JSON
119+import qualified Data.Aeson.Parser as JSON (value')
119120import Data.Attoparsec.ByteString.Char8 hiding (Result)
120121import Data.ByteString (ByteString)
121122import qualified Data.ByteString.Char8 as B
@@ -545,13 +546,7 @@ instance FromField JSON.Value where
545546 else case mbs of
546547 Nothing -> returnError UnexpectedNull f ""
547548 Just bs ->
548−#if MIN_VERSION_aeson(0,6,3)
549− case JSON.eitherDecodeStrict' bs of
550−#elif MIN_VERSION_bytestring(0,10,0)
551− case JSON.eitherDecode' $ LB.fromStrict bs of
552−#else
553− case JSON.eitherDecode' $ LB.fromChunks [bs] of
554−#endif
549+ case parseOnly (JSON.value' <* endOfInput) bs of
555550 Left err -> returnError ConversionFailed f err
556551 Right val -> pure val
557552