I'm learning about JAX-RS and Jersey. I am trying to post data to a URL however I have an issue I do not know to fix:
Form formData = new Form();
formData.param("merchant_id", mPayment.getMerchantId());
formData.param("transaction_id", mPayment.getTransactionId());
formData.param("code", mPayment.getCode());
formData.param("amount", String.valueOf(mPayment.getAmount()));
formData.param("desc", mPayment.getDesc());
formData.param("phone", mPayment.getPhone());
Response response = target.path("process").request()
.accept(MediaType.APPLICATION_JSON)
.post(Entity.form(formData));
Now everything works well when it's just a string however the server is expecting a float data type for the field amount however when I try to use it without String.valueOf()
I get an error. How do I add params with different data types so I can post?