All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.circe.syntax.package.scala Maven / Gradle / Ivy

There is a newer version: 0.13.0
Show newest version
package io.circe

/**
 * This package provides syntax via enrichment classes.
 */
package object syntax {
  implicit final class EncoderOps[A](val wrappedEncodeable: A) extends AnyVal {
    final def asJson(implicit encoder: Encoder[A]): Json = encoder(wrappedEncodeable)
    final def asJsonObject(implicit encoder: Encoder.AsObject[A]): JsonObject =
      encoder.encodeObject(wrappedEncodeable)
  }
  implicit final class KeyOps[K](val key: K) extends AnyVal {
    final def :=[A: Encoder](a: A)(implicit keyEncoder: KeyEncoder[K]): (String, Json) = (keyEncoder(key), a.asJson)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy