{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE ScopedTypeVariables #-} -- | -- Module : Network.Google.Data.JSON -- Copyright : (c) 2015 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : provisional -- Portability : non-portable (GHC extensions) -- module Network.Google.Data.JSON where import Control.Lens import Data.Aeson import Data.Aeson.Types import Servant.API type JSONValue = Value parseJSONText :: FromText a => String -> Value -> Parser a parseJSONText n = withText n (maybe (fail n) pure . fromText) toJSONText :: ToText a => a -> Value toJSONText = String . toText