on 1eabc15 help sign in
40 lines 1.0 kB history raw
1{-# LANGUAGE DeriveDataTypeable #-}
2{-# LANGUAGE GeneralizedNewtypeDeriving #-}
3{-# LANGUAGE ScopedTypeVariables #-}
5-- |
6-- Module : Network.Google.Data.JSON
7-- Copyright : (c) 2015 Brendan Hay <brendan.g.hay@gmail.com>
8-- License : Mozilla Public License, v. 2.0.
9-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
10-- Stability : provisional
11-- Portability : non-portable (GHC extensions)
12--
13module Network.Google.Data.JSON
14 ( module Network.Google.Data.JSON
16 , FromJSON (..)
17 , ToJSON (..)
19 , Value (Object)
20 , withObject
21 , object
23 , (.=)
24 , (.:)
25 , (.:?)
26 , (.!=)
27 ) where
29import Control.Lens hiding ((.=))
30import Data.Aeson
31import Data.Aeson.Types
32import Servant.API
34type JSONValue = Value
36parseJSONText :: FromText a => String -> Value -> Parser a
37parseJSONText n = withText n (maybe (fail n) pure . fromText)
39toJSONText :: ToText a => a -> Value
40toJSONText = String . toText