When JSON Fights You: Use a Boolean, Not “1”

This article is adapted from a post I shared on LinkedIn.

When I see JSON like this, I feel like I'm solving Sudoku:

{
  "invoiceAddress": {
    "isCommercial": "1",
    "isLikeCommercial": ""
  }
}

isCommercial: "1" → there is a thing called Boolean. isLikeCommercial → what is this supposed to mean, “I'm not commercial, but I kind of look like one”? And then an empty string — basically a fake version of null.

Small things, but they matter. A clean data contract — correct types, meaningful field names, real booleans and real nulls — saves every consumer of your API hours of guesswork. Type discipline is a form of respect for the next developer.