No implicit 'com.github.plokhotnyuk.jsoniter_scala.core.JsonValueCodec[_]' defined for 'Any'
See original GitHub issue当case class里面有Any类型时,或者Map的值是any类型时,编译会报错。
case class GenericMetric(timestamp: Long, metric: String, value: Any, tags: Map[String, String])
implicit val codec: JsonValueCodec[GenericMetric] = JsonCodecMaker.make[GenericMetric](CodecMakerConfig())
或者
case class GenericMetric(timestamp: Long, metric: String, value: Double, tags: Map[String, Any])
implicit val codec: JsonValueCodec[GenericMetric] = JsonCodecMaker.make[GenericMetric](CodecMakerConfig())
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
plokhotnyuk/jsoniter-scala - Gitter
if you can define your codecs in the companion classes then they will be in different scopes ... object Leaf1 { implicit val...
Read more >What is Scala 3 equivalent to this Scala 2 code that uses ...
As an option you can switch to jsoniter-scala. It supports enums for Scala 2 and ... import com.github.plokhotnyuk.jsoniter_scala.core.
Read more >com.github.plokhotnyuk.jsoniter_scala.macros ...
inferImplicitValue(getType(tq"com.github.plokhotnyuk.jsoniter_scala.core. ... fail(s"No implicit '${typeOf[JsonValueCodec[_]]}' defined for '$tpe'.
Read more >jsoniter-scala - Bountysource
_ import com.github.plokhotnyuk.jsoniter_scala.core. ... simdjson is probably the fastest json library on earth, jsoniter-scala might be the second fastest!
Read more >The fastest and safest JSON parser and serializer for Scala
Use the %%% operator instead of %% for Scala.js and Scala Native "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-core" % "2.19.0" ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If you have only
String
andInt
types for map values than instead ofAny
you can useEither[String, Int]
with a custom codec like here.@plokhotnyuk Following this question, I am trying Either[String, Int] with the custom codec here. While I got the CodecConfigurationException: Can’t find a codec for class scala.util.Left. Thank you.