Questions tagged [aeson]

A Haskell JSON parsing and encoding library optimized for high performance and easy usage

Aeson is a Haskell JSON parsing and encoding library optimized for high performance and easy usage.

It provides a typeclass-based interface for serializiation and parsing of object hierarchies (see the FromJSON and ToJSON typeclasses) andprovides lazy or strict parsing mechanisms.

Errors can be handled by using Maybe or Either, providing typesafe parsing of any object structure.

In greek mythology, Aeson was the father of Jason, therefore relating the library's name to the format it parses.

383 questions
0
votes
1 answer

How can i read Array in nested JSON using AESON

I am writing an app that use the Github Webhooks API. In the hook message i got this JSON structure: http://organicorange.ro:8000/set I am doing the type declaration like this: newtype CommitList = CommitList {commitList :: [Commit]} instance…
Deck Pope
  • 231
  • 3
  • 10
0
votes
1 answer

Transforming JSON with Aeson for testing

In an integration test of a Yesod REST service, the called API returns { "userId": "xxx" } where xxx is a MongoDB ObjectID (12 byte hex-encoded string). I would like to verify that the returned JSON is, in fact, in this form, using aeson. Is…
Ralph
  • 31,584
  • 38
  • 145
  • 282
0
votes
1 answer

Aeson Example not working

I'm following the Aeson library documentation but their example doesn't seem to work for me: Code: {-# LANGUAGE OverloadedStrings #-} import Data.Text import Data.Aeson import Control.Applicative ((<$>),(<*>)) import Control.Monad instance…
Sibi
  • 47,472
  • 16
  • 95
  • 163
0
votes
0 answers

Haskell Yesod start project error

Install Yesod Web-framework. Initialize project, then start it. Get an error: cabal: The following installed packages are broken because other packages they depend on are missing. These broken packages must be rebuilt before they can be…
Lissomort
  • 103
  • 1
  • 1
  • 7
-1
votes
1 answer

Stepping through Json with Haskell Aeson

I have some Json that I want to generate Java DAOs from, and would like to do that with the Aeson library. I have already done it in Python using the json module, something like this (snippet/pseudo): j = json.loads(jsonStr) def ob(j): while…
Erik Vesterlund
  • 481
  • 6
  • 19
-1
votes
1 answer

Sort [Value] by key

I have the following list of Value that I'd like to sort by the delta key. {-# LANGUAGE Haskell2010 #-} {-# LANGUAGE OverloadedStrings #-} import Data.Aeson lists :: [Value] lists = [ object ["label" .= String "foo", "delta" .= Number 2] ,…
amitaibu
  • 1,026
  • 1
  • 7
  • 23
-1
votes
1 answer

Converting JSON to Value with Data.Aeson

How can I convert JSON to Value or Data(Haskell) with Data.Aeson or get AST with arbitrary JSON if I don't know beforehand the structure of JSON?
Ivan
  • 85
  • 6
-3
votes
1 answer

How to extract list [] from Json file with AESON

I have this JSON code { "cod": "200", "message": 0.0205, "cnt": 40, "list": [{ "dt": 1529690400, "main": { "temp": 294.89, "temp_min": 289.889, "temp_max": 294.89, "pressure": 875.6, …
Ashot Bes
  • 39
  • 7
1 2 3
25
26