on cf863cd help sign in
26 lines 800 B 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 where
15import Control.Lens
16import Data.Aeson
17import Data.Aeson.Types
18import Servant.API
20type JSONValue = Value
22parseJSONText :: FromText a => String -> Value -> Parser a
23parseJSONText n = withText n (maybe (fail n) pure . fromText)
25toJSONText :: ToText a => a -> Value
26toJSONText = String . toText