Reputation: 1772
Issue is: The JsonObject drops the trailing zero from the REST request input, when the type is a decimal.
Example: If the Customer.Balance field has the following value:
Balance 465.000
The JSON sent wil be:
“Customer": [
{
"CustNum": 1,
"Balance": 465,
}]
But to process the request at server side we need number as decimal type only
Output required
“Customer": [
{
"CustNum": 1,
"Balance": “465.000”,
}]
Kindly suggest us some way to process these kinds of requests
Upvotes: 0
Views: 877
Reputation: 501
In the Client side use the class and send the object of that class in the request. for example -
class Request {
constructor(CustNum, Balance) {
this.CustNum = CustNum;
this.Balance = Balance;
}
}
const {CustNum, Balance} = this.props; //some way to get it
Axios.post("some URL", {
params : new Request(CustNum, Balance)
})
Upvotes: 0
Reputation: 5450
How about sending it as string and then parse it from string to intezer!
This will resolve the issue.
Upvotes: 1