API Design · Middle · Question 8 of 75
How should an API represent money?
- 1As a formatted string like
"1.234,56 €" - ✓Correct answer: As an amount in minor units (integer cents) or a decimal string, plus an explicit currency code like
"EUR" - 3As a floating-point number without currency
Explanation
Floats lose precision. Formatting belongs in the UI, based on the user's locale.