-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Tiny library to get fields from JSON format
--   
--   Tiny library to get fields from JSON format
@package aeson-picker
@version 0.1.0.4

module Data.Aeson.Picker

-- | From given JSON and selectors returns typed field. If input JSON is
--   not valid or selected field is not found then error is thrown. If you
--   need more safe way use '(|-?)' instead. Examples:
--   
--   <pre>
--   ghci&gt; "5" |-- [] :: Int
--   5
--   ghci&gt; "5" |-- [] :: Float
--   5.0
--   ghci&gt;"5" |-- [] :: String
--   *** Exception: Data.Aeson.Picker: could not pick field with path: []
--   
--   ghci&gt; :set -XOverloadedStrings
--   ghci&gt; "{\"a\": 5}" |-- ["a"] :: Int
--   5
--   ghci&gt; "{\"a\": 5}" |-- ["b"] :: Int
--   *** Exception: Data.Aeson.Picker: could not pick field with path: ["b"]
--   ghci&gt; "{\"outer\": {\"inner\": [1,2,3]}}" |-- ["outer", "inner"] :: [Int]
--   [1,2,3]
--   ghci&gt; {\"outer\": {\"inner\": [1,2,3]}}" |-- ["outer", "inner"] :: [Double]
--   [1.0,2.0,3.0]
--   ghci&gt; "{a: 5}" |-- ["a"] :: Int
--   *** Exception: Data.Aeson.Picker: input json is not valid
--   </pre>
(|--) :: (AsValue t, FromJSON a) => t -> [Text] -> a
infix 5 |--

-- | From given JSON and selectors returns typed field inside <a>Maybe</a>.
--   If input JSON is not valid then error is thrown. Examples:
--   
--   <pre>
--   ghci&gt; "5" |-? [] :: Maybe Int
--   Just 5
--   ghci&gt; "5" |-? [] :: Maybe String
--   Nothing
--   ghci&gt; "{\"a\": 5}" |-? ["a"] :: Maybe Int
--   Just 5
--   ghci&gt; "{a: 5}" |-? ["a"] :: Maybe Int
--   *** Exception: Data.Aeson.Picker: input json is not valid
--   </pre>
(|-?) :: (AsValue t, FromJSON a) => t -> [Text] -> Maybe a
infix 5 |-?
