Sha256: 8d0bdddcf4db31b1699529c8c08ce0e02f55704f6f179aedc2558a85a0c13c2b
Contents?: true
Size: 652 Bytes
Versions: 4
Compression:
Stored size: 652 Bytes
Contents
package org.embulk.parser.firebase_avro.json import io.circe.{Encoder, Json} object CustomEncoder { implicit val mapEncoder: Encoder[Map[String, Any]] = new Encoder[Map[String, Any]] { final def apply(a: Map[String, Any]): Json = { val jsonValues = a.keys.map { key => a(key) match { case v: String => (key, Json.fromString(v)) case v: Double => (key, Json.fromDouble(v).getOrElse(Json.fromString(v.toString))) case v: Long => (key, Json.fromLong(v)) case _ => (key, Json.Null) } } Json.fromFields(jsonValues) } } }
Version data entries
4 entries across 4 versions & 1 rubygems