@@ -33,6 +33,7 @@ module Data.Aeson.Types
3333 , (.=?)
3434 , (.:)
3535 , (.:?)
36+ , (./)
3637 , object
3738 ) where
3839
@@ -213,6 +214,16 @@ obj .:? key = case M.lookup key obj of
213214 Just v -> parseJSON v
214215{-# INLINE (.:?) #-}
215216
217+-- | Traverse a object heirarchy.
218+-- This is useful for traversing a JSON object to get to an
219+-- appropriate place before parsing.
220+(./) :: Value -> Text -> Value
221+(Object obj) ./ key = case M.lookup key obj of
222+ Nothing -> Missing
223+ Just v -> v
224+_ ./ _ = Missing
225+{-# INLINE (./) #-}
226+
216227-- | Create a 'Value' from a list of name\/value 'Pair's. If duplicate
217228-- keys arise, earlier keys and their associated values win.
218229object :: [Pair] -> Value