I am using Play Framework's WS API to make requests to a certain service. The service misbehaves if we send integers instead of doubles in JSON POST requests.
Even if we want to send { "value" : 2 }
, it would rather accept { "value" : 2.0 }
.
Is there a way to to that with Play Framework's JSON API which, I believe, uses json4s
.
From what I understands, when sending JSON value, Play Framework sends it as a string with Content-Type : application/json
header.
If not a proper way, can there be a workaround for this problem?
Code: (this is what my code would look like with my current approach).
def post(key: String, value: String): Future[(Int, String)] = {
val body = Json.obj(
"key" -> key,
"value" -> number
)
WS.url(???).post(body).map(w => (w.status, w.body))
}