Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    D Cameron Mauch
    @DCameronMauch
    I have an ADT called Product (sealed trait with a few case objects). I created encoder and decoder for it. But I need to encode/decode for Option[Product]. How do I do that?
    I would have thought if the base type has an encoder/decoder, it would already know how to handle an Option of that type.
    D Cameron Mauch
    @DCameronMauch
    Ah, my bad. Apparently, my ADT name had a conflict. It thought I was referring to Scala.Product, and not my ADT. Added import, and it works now.
    D Cameron Mauch
    @DCameronMauch
    Does anyone know how to create an encoder for a map? My specific type is Map[String, List[ZonedDateTime]].
    Andriy Plokhotnyuk
    @plokhotnyuk
    @DCameronMauch try jsoniter-scala, it already has much safe and efficient support of any Scala collections and ISO-8601 representation for java.time._ types: implicit val codec: JsonValueCodec[Map[String, List[ZonedDateTime]]] = JsonCodecMaker.make(CodecMakerConfig())
    D Cameron Mauch
    @DCameronMauch
    That doesn’t appear to work with Argonaut. I have no choice but to use Argonaut at this time.
    Andriy Plokhotnyuk
    @plokhotnyuk
    @DCameronMauch you always have choices, just not skip them... btw, I'm not sure that library maintainers care about users: argonaut-io/argonaut#314
    D Cameron Mauch
    @DCameronMauch
    I have to work within the parameters that I am given by the people who employee me. For today, that means I have to use Argonaut. So my only choices involve getting another job or endangering this one.
    Andriy Plokhotnyuk
    @plokhotnyuk
    @DCameronMauch Are their services opened to the wild wide world? Could you please share URL of some their endpoint? I will help you to show them what can happen... ;)
    D Cameron Mauch
    @DCameronMauch
    Just looking for a solution - not to rock the boat
    Rocking the boat and having that be interpreted as a positive and constructive thing is not currently in my skill set
    toxicafunk
    @toxicafunk
    A JSON is a basically a Map already
    D Cameron Mauch
    @DCameronMauch
    @toxicafunk thanks!
    Mohamedali10
    @Mohamedali10

    Hi, I have the following string that I pass to a Parse.EncodeEither method like below:

      val test ="""{"key":{"serial":0},"checkIn":true,"repositoryID":"rep_id","state":"disabled"} """
        val re = Parse.decodeEither[A](test).left.map(MalformedContent(_))

    I'am using argonaut 6.2.2, this code result in the below error:

    Left(MalformedContent(String: CursorHistory(List(El(CursorOpDownField(serial),true), El(CursorOpDownField(key),true))),None))
    Mohamedali10
    @Mohamedali10
    could the problem because of the tyoe of the serial number
    toxicafunk
    @toxicafunk
    That A looks suspicious
    Mohamedali10
    @Mohamedali10
    i will try to remove it
    even if I removed the A I have the same issue
    toxicafunk
    @toxicafunk
    Try something like parse(txt) match { case Right(j) => j case Left(failure) => Json.fromString(s"$failure") }
    I think for decodeEither[A] you would need sine case class that describes your Json
    That case class would be your A
    Without a case class for your codec you can only parse to a generic Json
    Mohamedali10
    @Mohamedali10
    parsing works correctly but the problem is with the decoding
    toxicafunk
    @toxicafunk
    So where's your case class and your decoder?
    Mohamedali10
    @Mohamedali10
    Hi is it possible to define Read play-json object from its argonaut decoding?
    Mohamedali10
    @Mohamedali10

    Hello, I have the following trait and case classes:

    sealed trait Base
     sealed trait  First extends Base
    case class Second(s: String) extends First

    Can someone tell me please How to define a codec json for the Base type?