1{-# LANGUAGE OverloadedStrings #-}
4-- Module: Data.Aeson.Parser
5-- Copyright: (c) 2012-2016 Bryan O'Sullivan
6-- (c) 2011 MailRank, Inc.
8-- Maintainer: Bryan O'Sullivan <bos@serpentine.com>
9-- Stability: experimental
10-- Portability: portable
12-- Efficiently and correctly parse a JSON string. The string must be
15-- It can be useful to think of parsing as occurring in two phases:
17-- * Identification of the textual boundaries of a JSON value. This
18-- is always strict, so that an invalid JSON document can be
19-- rejected as soon as possible.
21-- * Conversion of a JSON value to a Haskell value. This may be
22-- either immediate (strict) or deferred (lazy); see below for
25-- The question of whether to choose a lazy or strict parser is
26-- subtle, but it can have significant performance implications,
27-- resulting in changes in CPU use and memory footprint of 30% to 50%,
28-- or occasionally more. Measure the performance of your application
31module Data.Aeson.Parser
42 -- * Decoding without FromJSON instances
46 , eitherDecodeStrictWith
51import Data.Aeson.Parser.Internal (decodeStrictWith, decodeWith, eitherDecodeStrictWith, eitherDecodeWith, json, json', jstring, value, value')
55-- The 'json' and 'value' parsers decouple identification from
56-- conversion. Identification occurs immediately (so that an invalid
57-- JSON document can be rejected as early as possible), but conversion
58-- to a Haskell value is deferred until that value is needed.
60-- This decoupling can be time-efficient if only a smallish subset of
61-- elements in a JSON value need to be inspected, since the cost of
62-- conversion is zero for uninspected elements. The trade off is an
63-- increase in memory usage, due to allocation of thunks for values
64-- that have not yet been converted.
68-- The 'json'' and 'value'' parsers combine identification with
69-- conversion. They consume more CPU cycles up front, but have a
70-- smaller memory footprint.
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list