Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZIO JSON does not take into account some special numbers (Infinite, NaN) #292

Open
fsarradin opened this issue May 7, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@fsarradin
Copy link

With ZIO JSON 0.1.4 (under Scala 2.13), this example

case class Data(value: Double)

implicit val decoder = DeriveJsonDecoder.gen[Data]

println("""{ "value": "NaN" }""".fromJson[Data])
println("""{ "value": "Infinity" }""".fromJson[Data])
println("""{ "value": "-Infinity" }""".fromJson[Data])

gives

Left(.value(expected a number, got N))
Left(.value(expected a number, got I))
Right(Data(-Infinity))

The expected results would be

Right(Data(NaN))
Right(Data(Infinity))
Right(Data(-Infinity))
@fsvehla fsvehla added the bug Something isn't working label May 7, 2021
fsarradin added a commit to fsarradin/zio-json that referenced this issue May 7, 2021
fsarradin added a commit to fsarradin/zio-json that referenced this issue May 8, 2021
@fsvehla fsvehla added bug Something isn't working and removed bug Something isn't working labels May 8, 2021
fsarradin added a commit to fsarradin/zio-json that referenced this issue May 10, 2021
fsarradin added a commit to fsarradin/zio-json that referenced this issue May 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants