JSON is lovely. I just thought I'd say that. From a language point of view it allows rapid development, mocking and creation of code. However today I was talking about the misconceptions surrounding JSON. It is not an XML replacement for passing data, it is baked in to JavaScript.
For example
var a = new Object(); and
var a = {}
are equivilent;
Therefore it is possible to create objects really quickly
var obj = {
name: "test"
};
But it is also possible to deal with this in the more familiar object . (dot) mechanism
obj.age = 29;
obj.fields = [];
for( var i=0;i<10;i++){
obj.fields.push( i );
}
You can even mix and match these processes to build complex structures very easily and intuitively. Ace.
0 comments:
Post a Comment