Is there any standard as for sending amounts in rest ?
What is the proper way to send POST request with body with amount field and where can I find explanation ?
"amount": "2.222222222"
or
"amount": 2.222222222
Is there any standard as for sending amounts in rest ?
What is the proper way to send POST request with body with amount field and where can I find explanation ?
"amount": "2.222222222"
or
"amount": 2.222222222
Note that REST isn't always JSON. You appear to be actually asking about JSON-encoding money values.
If you're consuming an existing JSON API, you don't have a choice to make: the API spec will tell you whether the field is expected to be a string or a number.
If you're designing a new API, you need to make this choice.
The JSON standard specifies how to encode a number containing a decimal point, but it doesn't specify anything about how the decoded number should be represented. It's very likely that a decoding library would decode it as a floating-point number.
With very few exceptions, it's a bad idea to use floating-point for money: Why not use Double or Float to represent currency?. For this reason my advice would be use strings to transfer money values, and explicitly convert in both the client and the server. This means leaves less scope for intermediate JSON handling code to change the value.
Also note that a JSON Number has no unit. If you encode a monetary value as a string, you have the option to include a currency in the format: "£123.45". Of course both the encoder and the decoder would need to know about this format.