4      !"#$%&'()*+,-./0123 portable experimental%Bryan O'Sullivan <bos@serpentine.com>A key/value pair for an  . -A JSON value represented as a Haskell value. A JSON "array" (sequence). A JSON "object" (key/ value map). "A continuation-based parser type. 456Success continuation. 7Failure continuation. The result of running a  . 8The empty array. 9Determines if the  is an empty .  Note that:  isEmptyArray . The empty object. Run a  . Run a   with a : result type. Run a   with an ; result type.  Create a  from a list of name/value s. If duplicate ; keys arise, earlier keys and their associated values win.  9  9portable experimental%Bryan O'Sullivan <bos@serpentine.com>< Transform a = into a > while transforming the keys. ? Transform a = into a > while transforming the keys. @#Transform the keys and values of a >. ATransform the keys of a >. BCD<?@ABCD<?@ABCD portable experimental%Bryan O'Sullivan <bos@serpentine.com>A newtype wrapper for E! that uses the same non-standard / serialization format as Microsoft .NET, whose System.DateTime D type is by default serialized to JSON as in the following example:   /Date(1302547608878)/ 9The number represents milliseconds since the Unix epoch. @A type that can be converted from JSON, with the possibility of  failure. When writing an instance, use empty, mzero, or F to make a  conversion fail, e.g. if an   is missing a required key, or ! the value is of the wrong type. An example type and instance:  {-# LANGUAGE OverloadedStrings #-}  (data Coord { x :: Double, y :: Double }  instance FromJSON Coord where  parseJSON (  v) = Coord G  v  "x" H  v  "y"  -- A non- $ value is of the wrong type, so use mzero to fail.  parseJSON _ = mzero Note the use of the OverloadedStrings" language extension which enables  I* values to be written as string literals. !Instead of manually writing your # instance, there are three options  to do it automatically:   Data.Aeson.TH: provides template-haskell functions which will derive an M instance at compile-time. The generated instance is optimized for your type D so will probably be more efficient than the following two options:  Data.Aeson.Generic provides a generic fromJSON function that parses to " any type which is an instance of Data. & If your compiler has support for the  DeriveGeneric and  DefaultSignatures language extensions,  parseJSON will have a default  generic implementation. To use this, simply add a  deriving J clause to your datatype and  declare a FromJSON8 instance for your datatype without giving a definition  for  parseJSON. <For example the previous example can be simplified to just: {-# LANGUAGE DeriveGeneric #-}  import GHC.Generics  9data Coord { x :: Double, y :: Double } deriving Generic  instance FromJSON Coord &A type that can be converted to JSON. An example type and instance:  {-# LANGUAGE OverloadedStrings #-}  (data Coord { x :: Double, y :: Double }  instance ToJSON Coord where  toJSON (Coord x y) =  ["x"  x, "y"  y] Note the use of the OverloadedStrings" language extension which enables  I* values to be written as string literals. !Instead of manually writing your # instance, there are three options  to do it automatically:   Data.Aeson.TH: provides template-haskell functions which will derive an M instance at compile-time. The generated instance is optimized for your type D so will probably be more efficient than the following two options:  Data.Aeson.Generic provides a generic toJSON function that accepts any  type which is an instance of Data. & If your compiler has support for the  DeriveGeneric and  DefaultSignatures language extensions, toJSON will have a default generic  implementation. 'To use the latter option, simply add a  deriving J clause to your  datatype and declare a ToJSON- instance for your datatype without giving a  definition for toJSON. <For example the previous example can be simplified to just: {-# LANGUAGE DeriveGeneric #-}  import GHC.Generics  9data Coord { x :: Double, y :: Double } deriving Generic  instance ToJSON Coord KLMNOPQRS Construct a  from a key and a value. >Convert a value from JSON, failing if the types do not match. 7Retrieve the value associated with the given key of an  .  The result is empty/ if the key is not present or the value cannot # be converted to the desired type. 2This accessor is appropriate if the key and value must be present < in an object for it to be valid. If the key and value are  optional, use '(.:?)' instead. 7Retrieve the value associated with the given key of an  .  The result is T if the key is not present, or empty if 4 the value cannot be converted to the desired type. @This accessor is most useful if the key and value can be absent @ from an object without affecting its validity. If the key and  value are mandatory, use '(.:)' instead. #Helper for use in combination with  to provide default ) values for optional JSON object fields. BThis combinator is most useful if the key and value can be absent E from an object without affecting its validity and we know a default D value to assign in that case. If the key and value are mandatory,  use '(.:)' instead. Example usage:  v1 <- o  "opt_field_with_dfl" .!= " default_val"  v2 <- o  "mandatory_field"  v3 <- o  " opt_field2"  AFail parsing due to a type mismatch, with a descriptive message. .The name of the type you are trying to parse. The actual value encountered. KLMN KLLMNN portable experimental%Bryan O'Sullivan <bos@serpentine.com> UVWXYZ[\]^_`abcdefghijklmnopqrstportable experimental%Bryan O'Sullivan <bos@serpentine.com>!  !   portable experimental%Bryan O'Sullivan <bos@serpentine.com>!@Parse a top-level JSON value. This must be either an object or  an array, per RFC 4627. @The conversion of a parsed value to a Haskell value is deferred E until the Haskell value is needed. This may improve performance if B only a subset of the results of conversions are needed, but at a  cost in thunk allocation. "@Parse a top-level JSON value. This must be either an object or  an array, per RFC 4627. This is a strict version of !! which avoids building up thunks B during parsing; it performs all conversions immediately. Prefer = this version if most of the JSON data needs to be accessed. uvwxyz{#*Parse any JSON value. You should usually ! in preference to = this function, as this function relaxes the object-or-array  requirement of RFC 4627. CIn particular, be careful in using this function if you think your / code might interoperate with Javascript. A nave Javascript % library that parses JSON data using eval is vulnerable to attack A unless the encoded data represents an object or an array. JSON E implementations in other languages conform to that same restriction , to preserve interoperability and security. $Strict version of # . See also ". |}%Parse a quoted JSON string. ~(Parse a string without a leading quote. !"#$%!"#$%portable experimental%Bryan O'Sullivan <bos@serpentine.com>!"#$%!#%"$portable experimental%Bryan O'Sullivan <bos@serpentine.com>&Encode a JSON value to a . You can convert this to a  string using e.g. #, or encode straight to UTF-8 (the  standard JSON encoding) using '. '-Efficiently serialize a JSON value as a lazy . &'&'&'portable experimental%Bryan O'Sullivan <bos@serpentine.com>!The type constructor for readers !The type constructor for queries (-Efficiently serialize a JSON value as a lazy . )1Efficiently deserialize a JSON value from a lazy . 3 If this fails due to incomplete or invalid input, T is  returned. >This function parses immediately, but defers conversion. See  ! for details. *1Efficiently deserialize a JSON value from a lazy . 3 If this fails due to incomplete or invalid input, T is  returned. ?This function parses and performs conversion immediately. See  " for details. +,Flexible type extension 0Type extension of queries for type constructors 0Type extension of readers for type constructors ()*+,)*(,+()*+,portable experimental%Bryan O'Sullivan <bos@serpentine.com>-1Efficiently deserialize a JSON value from a lazy . 3 If this fails due to incomplete or invalid input, T is  returned. >This function parses immediately, but defers conversion. See  ! for details. .1Efficiently deserialize a JSON value from a lazy . 3 If this fails due to incomplete or invalid input, T is  returned. ?This function parses and performs conversion immediately. See  " for details.  !"'-.-.'  !"-.portable experimental/Generates both  and % instance declarations for the given  data type. DThis is a convienience function which is equivalent to calling both  0 and 2.  Function to change field names. 'Name of the type for which to generate  and   instances. 0 Generates a / instance declaration for the given data type.  Example:    data Foo = Foo Char Int  $(0  ''Foo) (This will splice in the following code:   instance  Foo where   =  value -> case value of ' Foo arg1 arg2 ->  $  $ do  mv <-  2   mv 0 ( arg1)   mv 1 ( arg2) " return mv  Function to change field names. )Name of the type for which to generate a  instance  declaration. 1IGenerates a lambda expression which encodes the given data type as JSON.  Example:    data Foo = Foo Int    encodeFoo :: Foo ->   encodeFoo = $(1 id ''Foo) (This will splice in the following code:   v"alue -> case value of Foo arg1 ->  arg1  Function to change field names. Name of the type to encode. Helper function used by both 0 and 1. Generates code M to generate the JSON encoding of a number of constructors. All constructors  must be from the same type.  Function to change field names. 9Constructors for which to generate JSON generating code. FGenerates code to generate the JSON encoding of a single constructor. 2 Generates a / instance declaration for the given data type.  Example:    data Foo = Foo Char Int  $(2 id ''Foo) (This will splice in the following code:   instance  Foo where   =  value -> case value of   arr -> . if (V.length arr == 2)  then Foo <$>  (arr  0)  <*>  (arr  1) ! else fail "< error message>" # other -> fail "< error message>"  Function to change field names. )Name of the type for which to generate a  instance  declaration. 3JGenerates a lambda expression which parses the JSON encoding of the given  data type.  Example:    data Foo = Foo Int    parseFoo ::  ->   Foo  parseFoo = $(3 id ''Foo) (This will splice in the following code:   \"value -> case value of arg -> Foo <$>  arg  Function to change field names. Name of the encoded type. Helper function used by both 2 and 3 . Generates O code to parse the JSON encoding of a number of constructors. All constructors  must be from the same type. 3Name of the type to which the constructors belong.  Function to change field names. 6Constructors for which to generate JSON parsing code. CGenerates code to parse the JSON encoding of a single constructor. 3Name of the type to which the constructor belongs.  Function to change field names. 5Constructor for which to generate JSON parsing code. 6Generates code to parse the JSON encoding of an n-ary  constructor. 3Name of the type to which the constructor belongs. structor name. structor arity. #Boilerplate for top level splices.  The given 3 must be from a type constructor. Furthermore, the E type constructor must be either a data type or a newtype. Any other $ value will result in an exception. 9Function that generates the actual code. Will be applied 9 to the type variable binders and constructors extracted  from the given . Resulting value in the  uasi monad. &Extracts the name from a constructor. /Extracts the name from a type variable binder. 4Makes a string literal expression from a constructor's name. >Creates a string literal expression from a record field name. #Function to change the field name. The name of the outermost  constructor. /0123/0213/0123       ! " # $ % & ' ( ) * + , - ./0012#%123456789:;<=><?@ABCDEFGHIJKL1MNO<PQ<RS<TUVWXYZ[ \ ] ^ _ ` a b c d<=e f g h i j k l m m n o p q r s t u v w x y z { | } } ~   VV!<P aeson-0.5.0.0Data.Aeson.TypesData.Aeson.ParserData.Aeson.EncodeData.Aeson.Generic Data.Aeson Data.Aeson.THData.Aeson.Types.InternalData.Aeson.FunctionsData.Aeson.Types.ClassData.Aeson.Types.GenericData.Aeson.Parser.InternalPairValueNullBoolNumberStringArrayObjectParserResultSuccessError emptyArray emptyObjectparse parseMaybe parseEitherobject DotNetTimefromDotNetTimeFromJSON parseJSONToJSONtoJSON.=fromJSON.:.:?.!= typeMismatchjsonjson'valuevalue'jstring fromValueencodedecodedecode' deriveJSON deriveToJSONmkToJSONderiveFromJSON mkParseJSON runParserFailureapP isEmptyArraybase Data.MaybeMaybe Data.EitherEither mapHashKeyValcontainers-0.4.1.0Data.MapMapunordered-containers-0.1.4.6Data.HashMap.CommonHashMap hashMapKey mapKeyValmapKeystrictlazy time-1.2.0.5Data.Time.Clock.UTCUTCTimeGHC.Basefail Data.Functor<$>Control.Applicative<*>text-0.11.1.13Data.Text.InternalTextghc-prim GHC.GenericsGeneric GFromJSON gParseJSONGToJSONgToJSONleftright parseIntegral vectorToJSONvectorParseJSONNothingFalseTrueIsRecordGFromSum gParseSum GFromProduct gParseProductTagged2 unTagged2 ProductSize productSize GFromRecord gParseRecord ConsFromJSON'consParseJSON' ConsFromJSON consParseJSONGObjectgObjectGProductToValuesgProductToValuesGRecordToPairsgRecordToPairsTaggedunTagged ConsToJSON' consToJSON' ConsToJSON consToJSONnotFoundjson_object_object_' objectValuesarray_array_' arrayValues doubleQuote backslashjstring_unescapehexQuad decodeWithData.Text.Lazy.BuilderBuilder toLazyTextstring fromNumberbytestring-0.9.2.0Data.ByteString.Lazy.Internal ByteString<>RunRQunQFT mungeFieldtoJSON_genericparseJSON_genericmodFailmodErrorext2'ext2Q'ext2R'id vector-0.9.1 Data.VectorcreateData.Vector.Mutable unsafeNew unsafeWrite encodeArgs unsafeIndex consFromJSON parseArgs parseProducttemplate-haskellLanguage.Haskell.TH.SyntaxCon matchFailedparseTypeMismatch lookupFieldunknownFieldFail noObjectFailwrongPairCountFailconNotFoundFailparseTypeMismatch'withTypeName getConNametvbName conNameExp fieldNameExp valueConName