logoalt Hacker News

ch2026yesterday at 5:40 PM1 replyview on HN

why does an API that only accepts json need me to specify in a header that it’s json.

just assume it’s json. you’re gonna parse and validate it anyway.


Replies

cess11yesterday at 7:10 PM

If it turns out that someone is willing to pay for some other protocol then they just have to hook it up to that MIME type and start serving. It might be possible that they can derive an implementation of that protocol from their data schemas.

If they hardcode JSON such a change would be breaking for their previous users.