Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.Aeson.Extended
Synopsis
- class ToJSONKeyValue a where
- toJSONKeyValue :: a -> (Key, Value)
- class FromJSONKeyValue a where
- parseJSONKeyValue :: (Key, Value) -> Parser a
- class FromJSONWithContext ctx a | a -> ctx where
- parseJSONWithContext :: ctx -> Value -> Parser a
- (.=?) :: (ToJSON v, KeyValue kv) => Key -> Maybe v -> Maybe kv
- mapWithJSONPath :: (a -> Parser b) -> [a] -> Parser [b]
- encodeToStrictText :: ToJSON a => a -> Text
Documentation
class ToJSONKeyValue a where Source #
Methods
toJSONKeyValue :: a -> (Key, Value) Source #
Instances
class FromJSONKeyValue a where Source #
Methods
parseJSONKeyValue :: (Key, Value) -> Parser a Source #
Instances
FromJSONKeyValue ColExp Source # | |
Defined in Hasura.RQL.IR.BoolExp Methods parseJSONKeyValue :: (Key, Value) -> Parser ColExp Source # |
class FromJSONWithContext ctx a | a -> ctx where Source #
Similar to FromJSON
, except the parser can also source data with which
to construct a
from a context ctx
.
This can be useful if the a
value contains some data that is not from the
current piece of JSON (the Value
). For example, some data from higher
up in the overall JSON graph, or from some system context.
Methods
parseJSONWithContext :: ctx -> Value -> Parser a Source #
Instances
Backend b => FromJSONWithContext (BackendSourceKind b) (SourceMetadata b) Source # | |
Defined in Hasura.RQL.Types.Metadata.Common Methods parseJSONWithContext :: BackendSourceKind b -> Value -> Parser (SourceMetadata b) Source # | |
Backend b => FromJSONWithContext (BackendSourceKind b) (AddSource b) Source # | |
Defined in Hasura.RQL.DDL.Schema.Source Methods parseJSONWithContext :: BackendSourceKind b -> Value -> Parser (AddSource b) Source # | |
Backend b => FromJSONWithContext (BackendSourceKind b) (UpdateSource b) Source # | |
Defined in Hasura.RQL.DDL.Schema.Source Methods parseJSONWithContext :: BackendSourceKind b -> Value -> Parser (UpdateSource b) Source # |
(.=?) :: (ToJSON v, KeyValue kv) => Key -> Maybe v -> Maybe kv infixr 8 Source #
An optional key-value pair for encoding a JSON object.
object $ ["foo" .= 0] <> catMaybes [ "bar" .=? Nothing, "baz" .=? 2 ]
mapWithJSONPath :: (a -> Parser b) -> [a] -> Parser [b] Source #
Map a Parser
over a list, keeping the JSONPath context
encodeToStrictText :: ToJSON a => a -> Text Source #