[Bug] Duplicate keys are encoded in json
bilal-fazlani opened this issue · 0 comments
bilal-fazlani commented
import zio.json.*
@jsonDiscriminator("type")
sealed trait GithubIssue derives JsonCodec
@jsonHint("bug")
case class Bug(`type`: String, title: String) extends GithubIssue
@main def reproduce = {
val bug:GithubIssue = Bug("bug", "duplicate keys are added to json")
val json = bug.toJson
println(json)
}
This prints following
{"type":"bug","type":"bug","title":"duplicate keys are added to json"}