News for hackers. Stuff that matters.
Re:How to (and how not to) design REST APIs by brongondwana on Wednesday November 22, 2023 @09:22PM (#38388429)
I would extend Rule 6 much more into Rule 7 - if you're returning an id which is numeric, prefix it with a non-number, so it won't get accidentally converted to a number. This has been a particular pain with Perl (yes, it's still used in place) JSON libraries, where knowing if you're going to serialise to a string or a number is quite dependent on how the variable has been touched - so things like stringifying it in a debug line might change the output.

If you make it so your ID is never something that Excel can incorrectly assume is a date, you're making life better for everybody.

There are no comments on this comment yet.