Is your feature request related to a problem? Please describe.
Any web application operates with JSON, many API often both receive JSON and send in a monetary format.
Describe the solution you'd like
We need to add the toJson method, which returns something like:
"{"amount":5,"currency":"USD"}"
Example
createMoney({ amount: 5, currency: "USD" }).toJSON()
// => "{"amount":5,"currency":"USD"}"
Don't forget that Currency can be also an Object type, it's also need serialization method.
Packages:
- @easymoney/money
- @easymoney/bignumber.js
- @easymoney/bignumber-money
Is your feature request related to a problem? Please describe.
Any web application operates with JSON, many API often both receive JSON and send in a monetary format.
Describe the solution you'd like
We need to add the toJson method, which returns something like:
Example
Don't forget that Currency can be also an Object type, it's also need serialization method.
Packages: