Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add Prism for Json conversion #14

Closed
julien-truffaut opened this Issue · 5 comments

3 participants

@julien-truffaut

No description provided.

@rossh

@julien-truffaut Have you got any details for this one? Is it easy? :-)

@julien-truffaut

It is quite a big project, the first part consist of creating Prism from String to Json AST:

sealed trait Json
case class StringJson(s: String) extends Json
case class NumberJson(n: BigDecimal) extends Json
case class ObjectJson(obj: Map[String, Json]) extends Json
....

toJsonAST: SimplePrism[String, Json]
toJsonAST.get("{"key" : "value"}") == Some(ObjectJson(Map("key", StringJson("value"))))
toJsonAST.get("...") == None

@puffnfresh

Would it be sensible to use Argonaut?

@julien-truffaut

I haven't really looked into it yet. We can either create the interface with some type classes and then propose bindings for common Json libraries or simply base the implementation on a single Json library.

The latter is probably easier but it adds another dependency and I would like to limit them as much as possible. I am open to any proposal ;)

@julien-truffaut

Argonaut will add a dependency to Monocle, we will make the integration their.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.