Lesson 40. Working with JSON data by using Aeson

After reading lesson 40, you’ll be able to

  • Transform Haskell types into JSON
  • Read JSON into a Haskell type
  • Use the DeriveGeneric extension to implement needed classes
  • Write you own instances of ToJSON and FromJSON

In this lesson, you’ll work with JavaScript Object Notation (JSON) data, one of the most popular ways to store and transmit data. The JSON format originates in simple JavaScript objects and is heavily used in transmitting data through HTTP APIs. Because the format is so simple, it has seen widespread adoption outside the web, frequently being used as a method of storing data and for tasks such as creating configuration files. Figure 40.1 shows an example JSON object used with the ...

Get Get Programming with Haskell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.