null

In JavaScript, you assign value null to an object property to indicate that the property is defined but with no value. But using null outside the JavaScript domain becomes tricky. For example, in URL query parameters:

?foo=null&bar=bar

after parsing the query:

{
  "foo": "null",
  "bar": "bar"
}

Should the value of foo be parsed from "null" string into null object? Unless you know the context.

Using null in both schema design and URL query gave me a few headaches. So, I have decided to use string and throw away null. As string is the most basic data type across many applications. For simplier design and greater compatibility and portability, use empty string instead of null.

Therefore, the value of query parameter foo should be:

?foo=null&bar=bar // "null"
?foo=&bar=bar     // ""

and:

"null" !== ""