-
Notifications
You must be signed in to change notification settings - Fork 145
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
Easy api to create custom en-/decoders #689
Labels
enhancement
New feature or request
Comments
@987Nabil You can use |
I imagine you mean something like final case class Person(firstName: String, lastName: String, age: Int)
io.circe.Decoder.forProduct3[Person, String, String, Option[Int]](
"firstName",
"lastName",
"age",
) { (firstName, lastName, age) =>
Person(firstName, lastName, age.getOrElse(0))
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I do understand, that the main way to create en-/decoders are macros.
But in my experience, you always have some cases, where you'd like to have some custom ones.
I thought of something like the play json api to create reads/writes.
Or in the lights of Scala 3 context functions maybe something like
This is more a basic idea and needs discussion, I guess.
Edit
JsonCursor
could maybe be used to describe the structure of the data.And to clarify this: I am talking about having a static description and generate out of it en-/decoders, that do not convert to the json ast first.
The text was updated successfully, but these errors were encountered: