You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have noticed a weird inconsistency depending on how the json is created when interacting with the mapper (c.f. #48):
importcats.syntax.either._importcats.syntax.eq._importio.circe.Jsonimportio.circe.literal._importio.circe.syntax._valjson1=json"""{"latitude": 43.1, "longitude": 32.1}"""// same with im.circe.parser.parsevaljson2=Json.obj("latitude":=Json.fromDoubleOrNull(43.1), "longitude":=Json.fromDoubleOrNull(32.1))
println(json1 === json2) // true// a lib I'm using requires me to convert it to an objectvalpojo1= io.circe.jackson.mapper.convertValue(json1, classOf[Object])
valpojo2= io.circe.jackson.mapper.convertValue(json2, classOf[Object])
println(pojo1 == pojo2) // false// Stringvalc1=Either.catchNonFatal(
pojo1.asInstanceOf[java.util.HashMap[Object, Object]].get("latitude").getClass)
// Doublevalc2=Either.catchNonFatal(
pojo2.asInstanceOf[java.util.HashMap[Object, Object]].get("latitude").getClass)
println(c1)
println(c2)
using circe-literal or parse doubles get turned to strings whereas they stay doubles when creating jsons in line.
I have noticed a weird inconsistency depending on how the json is created when interacting with the mapper (c.f. #48):
using circe-literal or
parse
doubles get turned to strings whereas they stay doubles when creating jsons in line.Here is a scastie reproducing the issue https://scastie.scala-lang.org/VMydlc7ITW2PYBn2NgizUw . However it relies on #48.
The text was updated successfully, but these errors were encountered: