spartanz / schemaz

A purely-functional library for defining type-safe schemas for algebraic data types, providing free generators, SQL queries, JSON codecs, binary codecs, and migration from this schema definition
https://spartanz.github.io/schemaz
Apache License 2.0
164 stars 18 forks source link

Implement a JSON serializer #18

Closed vil1 closed 5 years ago

vil1 commented 6 years ago

We should now have enough material to try and implement a first serializer.

The main idea is to implement a function like the following:

def jsonSerializer[A](schema: Schema[A])(implicit prims: ToJson[Prim[A]]): A => JSON = ???

Where ToJson is a simple typeclass needed to convert the primitive types of the module to JSON. The actual JSON representation isn't very important for now, we can just define type JSON = String for the moment.

mmenestret commented 6 years ago

I'll try to work on that one if that's ok :)

vil1 commented 5 years ago

Done in #26