Morgan Packard <he****************@gmail.comwrites:
....
var myJsonObj2 = {
Functions.myfunction: "some value"
}
Can anyone explain why my browser complains when creating the second
myJsonObj2 (missing : after property id
[Break on this error] Functions.myfunction : "some value" \n)? Can I
not have dot notation in a JSON key?
Indeed, you cannot have a dot.
In fact, in JSON all keys *must* be quoted. I.e.:
{"refToFunction" : "some value", "Functions.myfunction": "some value"}
Many parsers for JSON will ignore this constraint, especially those using
Javascript's "eval" function.
In Javascript, keys that are also valid identifiers or number literals
may be left unquoted:
{refToFunction: "some value", "Functions.myfunction": "some value",
2: "some value", true: "some value"}
/L
--
Lasse Reichstein Nielsen
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'