Uploaded image for project: 'Scala Couchbase Client'
  1. Scala Couchbase Client
  2. SCBC-199

Allow mapping case class fields with different names when converting to/from JSON

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 1.0.2
    • None
    • None
    • None
    • 1

    Description

      Code example:

      import com.couchbase.client.scala.implicits.Codec
      import com.github.plokhotnyuk.jsoniter_scala.macros.CodecMakerConfig
       
      case class User(name: String, age: Int, addresses: Seq[Address])
      object User {
        implicit val codec: Codec[User] = Codec.codec[User](
          CodecMakerConfig.withFieldNameMapper(
            Map("name" -> "n", "age" -> "a", "addresses" -> "s")
          )
        )
      }

      Attachments

        Activity

          People

            graham.pople Graham Pople
            thanhbv thanhbv
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              PagerDuty