Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wayofthepie/conduit-json-stream

Hacking about with conduit and json-stream
https://github.com/wayofthepie/conduit-json-stream

Last synced: 9 days ago
JSON representation

Hacking about with conduit and json-stream

Awesome Lists containing this project

README

        

# Hacking
Some hacking about with the conduit and json-stream libraries.

## Working Example
Some notes so I remember... Given the following json in a file **simple.json**:
```json
{
"a": {
"b" : "c",
"d" : {
"e": "f"
}
}
}
```
I want to extract the value of **b** and **e**:
```haskell
-- | The parser would be as follows
p :: Parser (T.Text, T.Text)
p = (,) <$> "a" .: "b" .: string
<*> "a" .: "d" .: "e" .: string

-- | And the conduit
jsonC "simple.json" p

-- | This gives
[("c","f")]
```