tdammers / ginger

A Haskell implementation of the Jinja template language.
MIT License
77 stars 13 forks source link

Implement "tojson" filter #11

Closed rakeshkky closed 7 years ago

rakeshkky commented 7 years ago

Need tojson filter in which {{ info | tojson }} should interpolate JSON value of info while rendering.

For example, my data type is data Interpolate = Interpolate { info :: Data.Aeson.Object } which is ToJSON instance.

tdammers commented 7 years ago

This should do the trick (documentation here). You still need to provide a ToGVal instance for your type, but that shouldn't be too hard to figure out.