aeson-1.4.2.0: Fast JSON parsing and encoding

Copyright(c) 2011-2016 Bryan O'Sullivan
(c) 2011 MailRank Inc.
LicenseBSD3
MaintainerBryan O'Sullivan <bos@serpentine.com>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Data.Aeson.Parser.Internal

Contents

Description

Efficiently and correctly parse a JSON string. The string must be encoded as UTF-8.

Synopsis

Lazy parsers

json :: Parser Value #

Parse a top-level JSON value.

The conversion of a parsed value to a Haskell value is deferred until the Haskell value is needed. This may improve performance if only a subset of the results of conversions are needed, but at a cost in thunk allocation.

This function is an alias for value. In aeson 0.8 and earlier, it parsed only object or array types, in conformance with the now-obsolete RFC 4627.

jsonEOF :: Parser Value #

Parse a top-level JSON value followed by optional whitespace and end-of-input. See also: json.

value :: Parser Value #

Parse any JSON value. You should usually json in preference to this function, as this function relaxes the object-or-array requirement of RFC 4627.

In particular, be careful in using this function if you think your code might interoperate with Javascript. A naïve Javascript library that parses JSON data using eval is vulnerable to attack unless the encoded data represents an object or an array. JSON implementations in other languages conform to that same restriction to preserve interoperability and security.

jstring :: Parser Text #

Parse a quoted JSON string.

jstring_ :: Parser Text #

Parse a string without a leading quote.

scientific :: Parser Scientific #

Parse a JSON number.

Strict parsers

json' :: Parser Value #

Parse a top-level JSON value.

This is a strict version of json which avoids building up thunks during parsing; it performs all conversions immediately. Prefer this version if most of the JSON data needs to be accessed.

This function is an alias for value'. In aeson 0.8 and earlier, it parsed only object or array types, in conformance with the now-obsolete RFC 4627.

jsonEOF' :: Parser Value #

Parse a top-level JSON value followed by optional whitespace and end-of-input. See also: json'.

value' :: Parser Value #

Strict version of value. See also json'.

Helpers