Portability | portable |
---|---|
Stability | development |
Maintainer | mariusz@scrive.com |
Abusing monadic do notation library for generating JSON object. Hard-binded to json package from hackage. Main ideas
- Overloaded function
field
, that may set values of fields of different types -Bool
,Int
,String
, lists etc. - Internal IO - value of the field can be IO a, is we know how to put a into JSON. That means that there is no need to do prebinding
- Compositionality - value of field can also be fields. Easy to do embeded objects
- Monadic notation - it really looks nicer then composition with
.
or some magic combinator
json $ do field "a" "a" field "b" [1,2,3] field "c" $ do field "x" True field "y" False
Will generate json object {a : a, b: [1,2,3], c: {x: true, y : false}}
Documentation
The JSField
class instances are object that in some sence can be interpreted as value of JSON object fields.
To derive new instances use existing instances since internal structure JSFields
is hidden.