Maintainer's Corner

Readme for aeson-picker-0.1.0.2

aeson-picker

Tiny library to get fields from JSON format

Common use is the following:

JSON |-- FIELDS :: EXPECTED TYPE
Text |-- [Text] :: a

So operator (|--) gets JSON (represented as Text), "route" to field inside JSON (represented as [Text]), and tries to parse field from JSON with described route to expected type.
If expected type can be deduced with type checker then it can be dropped down.

A little bit safer operator is (|-?). It returns not a but Maybe a.

Examples

First, add extension (to not pack String to Text every time):

ghci>:set -XOverloadedStrings

Then you can try something simple (empty list means that you try to parse Value from the top JSON-level):