We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
extras-circe
renameFields
Codec
Json
[extras-circe] Add renameFields for Codec to rename circe Json fields
Version: 0.32.0
0.32.0
final case class Something(a: Int, b: String, price: BigDecimal, c: Boolean) object Something { import extras.circe.codecs.codec._ implicit val somethingEncoder: Codec[Something] = deriveCodec[Something].renameFields( "a" -> "productNumber", "b" -> "name", "c" -> "inStock", ) } val something = Something(1, "Vibranium Shield", BidDecimal(9999999), false)
Encoding:
import io.circe.syntax._ something.asJson.spaces2
{ "id": 1, "name": "Vibranium Shield", "price": 9999999, "inStock": false }
Decoding:
val json = """{ "productNumber": 1, "name": "Vibranium Shield", "price": 9999999, "inStock": false }""" import io.circe.parser._ decode[Something](json) // Either[Error, Something] = Right(Something(a = 1, b = "Vibranium Shield", price = 9999999, c = false))
The text was updated successfully, but these errors were encountered:
Close #336 - [extras-circe] Add renameFields for Codec to rename circ…
d6cd582
…e Json fields
0c89b1e
Merge pull request #338 from Kevin-Lee/task/336/renameFields-for-Codec
9af8448
Close #336 - [`extras-circe`] Add `renameFields` for `Codec` to rename circe `Json` fields
kevin-lee
Successfully merging a pull request may close this issue.
Task
Summary
[
extras-circe
] AddrenameFields
forCodec
to rename circeJson
fieldsProject Details
Version:
0.32.0
Description
Encoding:
Decoding:
The text was updated successfully, but these errors were encountered: