"JavaScript contains a small set of data types. It has the three
primitive types boolean, number, and string and the special values
null and undefined. Everything else is variations on the object type."
- http://javascript.crockford.com/survey.html
"Vars are not typed. A var can contain a reference to an object, or a
Jan 23 2008 by David Wilhelm
I think it is useful to treat null as a type, as it doesn't belong to
any other type, but it is a valid JSON value.
On this topic, I noticed that when I attempt to validate the object:
{
"foo":null
with the schema:
{
"foo":{
"type":"null"
I'm still getting the error:
foo
is non-nullable, but has a null value
Jan 23 2008 by Jakob Kruse
Kris,
I find this choice rather questionable. The possible values of the
"type" defintion should be just that - types. "null" is not a type,
it's a value. Including "null" as a possible "type" value is just
starting down a slope where "true" and "false" come next (in JSON
specs they are treated the same), and that's just plain wrong.