It is amazing how something dormant for a long time in the developer community emerges simultaneously at different spots.
My own Show love to the object literal was basically intended to explain the OL as a coding style and syntax allowing your scripts to be self-contained.
Read all about how Dustin and me got informed about what is wrong or what is good about what we said:
Now here is my view on the matter:
The object literal
Jason, err JSON
I like JSON as a data format, but it is not the same as the OL. JSON is a subset of the OL, and basically is a scripting syntax version of XML: It is there to hold data to send it back and forth in a readable and easily convertible way. JSON allows and encourages things like:
‘my wedding’:’fat and Greek’,
‘Plan’:’9 from outer space’,
‘Red Hot Chili Peppers’:’Flea, Anthony, and many random others’
This would be quite confusing in a script, although you can read out
data['my wedding'] all the same. I’d consider it harmful as part of a script, as it does not quite promote valid variable names.
How about this: Calling JSON and the OL the same thing is as misleading as calling XML and semantic markup the same thing. One is data, the other is good practice (yes, you are allowed a different opinion).