curl-aeson: Communicate with web services using JSON

[ bsd3, json, library, network, web ] [ Propose Tags ]

A library for communicating with JSON over HTTP(S) or any other protocols supported by cURL. connection.

Supports rich set of connectivity features provided by libcurl combined to the performance and elegancy of aeson.

All HTTP methods are supported. Instances of ToJSON and FromJSON typeclasses can be transferred via this library. Session cookies and other HTTP options may be passed to libcurl if needed.

This library is at its best when communicating with simple, non-standardized JSON interfaces. If you are implementing JSON-RPC compliant client or server, take a look at http://hackage.haskell.org/package/jmacro-rpc.


[Skip to Readme]

Modules

[Last Documentation]

  • Network
    • Curl
      • Network.Curl.Aeson

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.0.3, 0.0.4, 0.1.0.0, 0.1.0.1
Dependencies aeson (>=0.6), base (>=4 && <5), bytestring (>=0.10.8.1 && <0.12), curl (>=1.3 && <1.4), text (>=1.2.3.0 && <1.3 || >=2.0 && <2.1) [details]
License BSD-3-Clause
Author Joel Lehtonen
Maintainer joel.lehtonen+curlaeson@iki.fi
Category Network, Web, JSON
Home page https://github.com/zouppen/haskell-curl-aeson
Bug tracker https://github.com/zouppen/haskell-curl-aeson/issues
Source repo head: git clone https://github.com/zouppen/haskell-curl-aeson.git
Uploaded by JoelLehtonen at 2022-03-31T02:07:36Z
Distributions
Reverse Dependencies 2 direct, 0 indirect [details]
Downloads 2514 total (18 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2022-03-31 [all 2 reports]

Readme for curl-aeson-0.1.0.1

[back to package description]

curl-aeson library for Haskell

This is a library for communicating with JSON over HTTP connection. It supports rich set of HTTP connectivity features provided by curl library combined to the performance and elegance of aeson.

Author: Joel Lehtonen joel.lehtonen+curlaeson@iki.fi

This library is at its best when communicating with simple, non-standardized JSON interfaces. If you are implementing JSON-RPC compliant client or server, take a look at another library.

Example

Let's simulate a ticker service by creating a file /tmp/ticker.json with the following content:

{"bid":3,"ask":3.14}

We then define our own data type and define a function which reads the payload from the service:

{-# LANGUAGE DeriveGeneric #-}
import GHC.Generics
import Data.Aeson
import Network.Curl.Aeson

data Ticker = Ticker { bid :: Double
                     , ask :: Double
                     } deriving (Generic, Show)

instance FromJSON Ticker

ticker :: IO Ticker
ticker = curlAesonGet "file:///tmp/ticker.json"

You may find more examples from package documentation.

Installation

On Ubuntu and Debian

Starting from Ubuntu 12.04 and Debian wheezy, all dependencies are found from repositories:

sudo apt-get install libghc-aeson-dev libghc-curl-dev cabal-install

Then just install this:

cabal install

Other

Install and configure Haskell Platform. Then, fetch all the requirements and install this library by running:

cabal update
cabal install

License

Following the convention of Haskell community, this library is licensed under the terms of BSD 3-clause license. Personally I prefer GPLv3, but this library is simple enough to be released with non-copyleft license.

The license text is included in LICENSE file.

Contact

I'm not an expert in doing software packages, so feel free to correct me by sending pull requests. Also, I would like to hear if you have found my library to be useful.