I have a Json string, after parsing I want it to remain in decimal form.
import play.api.libs.json._
val jsonString = """{"value":2.0}"""
println(jsonString)
println(Json.parse(jsonString))
The output of the code above is:
{"value":2.0}
{"value":2}
I need it to be
{"value":2.0}
{"value":2.0}
play-json created an option to preserve zero decimals
https://github.com/playframework/play-json/pull/831/files
Just add -Dplay.json.serializer.preserveZeroDecimal=true
to VM options.