You can clone with
HTTPS or Subversion.
I want to have distinction between absence of field and its null value.
data Blah = Blah (Maybe (Maybe String))
instance FromJSON Blah where
parseJSON (Object v) = Blah <$> v .:? "blah"
Blah Nothing -- if field not mentioned
Blah (Just Nothing) -- if field has null value
However, the result of parsing is never Blah (Just Nothing) because .:? uses (Maybe a) instance directly.
Blah (Just Nothing)
(.:?) :: (FromJSON a) => Object -> Text -> Parser (Maybe a)
obj .:? key = case H.lookup key obj of
Nothing -> pure Nothing
Just v -> parseJSON v
-- Just v -> Just <$> parseJSON v would have expected behavior
The obvious fix for this breaks some of the test suite, and I haven't had a chance to diagnose that yet. Looking.
Fix .:? behavior for #83