Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for custom FromJSON/ToJSON instances #24

Open
legrostdg opened this issue Feb 10, 2017 · 0 comments
Open

add support for custom FromJSON/ToJSON instances #24

legrostdg opened this issue Feb 10, 2017 · 0 comments

Comments

@legrostdg
Copy link

legrostdg commented Feb 10, 2017

From README.md:

For compatible JSON representations you should be using aeson's generic encoding/decoding with default options and encodeJson and decodeJson from "Data.Argonaut.Generic.Aeson" in purescript-argonaut-generic-codecs.

It would be great to be able to support custom instances of FromJSON/ToJSON.

I'd like to be able to have a model like this:

data Book = Book { title :: String, pages: Int }

with lenses

book ^. bookTitle
book ^. bookPages

and with json

{ "title": "Test", "pages": 50 }

instead of the ugly

 { "_bookTitle": "Test", "_bookPages": 50 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants