Well I have always used
var j= {};
j['field'] = value;
Apparently below works too
var j= [];
j['field'] = value;
Any difference?
Edit: Sorry I guess I used the wrong word json here instead of object. My bad. But my questions till stands. Most people are explaining the difference between an array and object to me which I am familiar with.
I always do var x = []; x.push('blah') etc.
I also do var x = {}; x.Name = 'Michael'; x.Age = 21 etc.
What I was surprised to see and what prompted me to ask this is I saw code that goes like var x = []; x.name = 'Michael';
This is something I wasn't used to and hence posted the question.
Thanks for all the answers. I have marked accepted answer which addressed my question the best