Christopher Lenz schrieb:

If you need to state that a JSON object doesn't have a property, simply omit it. No need for an undefined keyword.

Also note that "undefined" is not a keyword in Javascript either, it's the string value returned by `typeof somethingUndefined`.


ECMA-262 defines undefined as:

4.3.9  Undefined Value
The undefined value is a primitive value used when a variable has not been assigned a value.
4.3.10 Undefined Type
The type Undefined has exactly one value, called undefined.

it's not just a name. Try this in a javascript console:

var foo; alert( foo === undefined);

undefined is a special value of a builtin Type, just like true, false or null.

> I'm not sure what problem you're trying to solve here.

It's easier in some languages / situtations to be able to substitute null, meaning no revision. In my case the problem was solvable with an additional annotation attribute, it might be more difficult in other situations.

I'm not saying that this is a real problem. I was just wondering what the omission of undefined (and other special values like NaN) means for
JSON and applications using it. And I thought I just mention it here.

Sven Helmberger

Reply via email to