@@ -446,14 +446,15 @@ fromArray typeInfo f = sequence . (parseIt <$>) <$> array delim
448instance FromField JSON.Value where
448instance FromField JSON.Value where
449− fromField f Nothing = returnError UnexpectedNull f ""
449+ fromField f mbs =
450− fromField f (Just bs)
451− | typeOid f /= $(inlineTypoid TI.json) =
450+ if typeOid f /= $(inlineTypoid TI.json)
452− returnError Incompatible f ""
451+ then returnError Incompatible f ""
453− | otherwise =
452+ else case mbs of
453+ Nothing -> returnError UnexpectedNull f ""
454− case JSON.eitherDecode' $ LB.fromStrict bs of
455+ case JSON.eitherDecode' $ LB.fromStrict bs of
455− Left err -> returnError ConversionFailed f err
456+ Left err -> returnError ConversionFailed f err
456− Right val -> pure val
457+ Right val -> pure val
458-- | Parse a field to a JSON 'JSON.Value' and convert that into a
459-- | Parse a field to a JSON 'JSON.Value' and convert that into a
459-- Haskell value using 'JSON.fromJSON'.
460-- Haskell value using 'JSON.fromJSON'.