tags:

views:

45

answers:

2
var phoneBookTableValue = [];
phoneBookTableValue.push({ "key":"1", "value":["3396,Accounting ,CCH,,,,","1"]});
phoneBookTableValue.push({ "key":"2", "value":["3284,Acute Care ,CCH,,,,","2"]});
phoneBookTableValue.push({ "key":"3", "value":["3265,Acute'Care East ,CCH,,,,","3"]});

When running the javascript file I get the error "missing ] after element list. Can U help me? PLZ!

A: 

I ran your code in Firefox, Chrome and IE8 with no trouble. What browser are you using? I would guess the real problem is in how the JSON is being eval'ed.

Robusto
+1  A: 

That is not JSON, that is just literal Javascript objects. JSON is a text format based on Javascript syntax.

There is nothing wrong with the Javascript code. You could also copy the literal objects from the code and paste together into a JSON string, and it would work.

Are you converting the objects to JSON later on? In that case there is something wrong with that code.

Guffa