Join the Stack Overflow Community
Stack Overflow is a community of 6.5 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I have a variable:

var value=[
{"0","0",650,"0","0",357,"0","0","0","0",200,"0",48,"0",3053,"0","0","0","0","0",45,50}
,{"0","0",299,101,"0",126,"0","0","0","0",630,"0","0",88,3157,"0","0","0","0","0",10,21}
,{"0","0",123,3030,"0",368,"0","0","0","0","0","0",76,-44,1967,"0","0","0","0","0",29,64}
,{"0","0",88,343,"0",320,"0","0","0","0","0","0",175,"0",336,"0","0","0","0","0",21,98}
,{"0","0",503,410,"0",1127,"0","0","0","0","0","0",77,87,1264,"0","0","0","0","0",5,128}
,{"0","0",1754,607,40,2565,"0","0","0","0","0","0",102,70,12506,"0","0","0","0","0",178,1966}
,{"0","0","0","0",60,153,"0","0","0","0","0","0","0","0","0","0","0","0","0","0",15,"0"}
]
var result= JSON.parse(value);

When I parse it in javacript as JSON, an error occurs :

Uncaught SyntaxError: Unexpected token ,

share|improve this question

closed as unclear what you're asking by Clive, charlietfl, Amit, Jan Dvorak, twernt Feb 29 at 1:56

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
What do you expect? – Amit Feb 28 at 21:04
3  
There are numerous json validators you could have pasted this into before coming here. Not to mention there isn't even a question here – charlietfl Feb 28 at 21:07
1  
don't update question with the solution...it renders the original problem and answers useless – charlietfl Feb 28 at 23:11
up vote 1 down vote accepted

Objects in JSON are represented with {}. Object have key-value pairs. For example:

{
    "foo": "bar",
    "example: "something",
    "key": "value"
}

Arrays in JSON are represented with []. They are a list of numbers, strings, objects, etc. For instance:

[
    "foo",
    "bar",
    "something",
    "example"
]

You're problem is that you are using {} for an array. Try changing your JSON to:

[
    ["0","0",650,"0","0",357,"0","0","0","0",200,"0",48,"0",3053,"0","0","0","0","0",45,50,["0","0",299,101,"0",126,"0","0","0","0",630,"0","0",88,3157,"0","0","0","0","0",10,21],["0","0",123,3030,"0",368,"0","0","0","0","0","0",76,-44,1967,"0","0","0","0","0",29,64],["0","0",88,343,"0",320,"0","0","0","0","0","0",175,"0",336,"0","0","0","0","0",21,98],["0","0",503,410,"0",1127,"0","0","0","0","0","0",77,87,1264,"0","0","0","0","0",5,128],["0","0",1754,607,40,2565,"0","0","0","0","0","0",102,70,12506,"0","0","0","0","0",178,1966],["0","0","0","0",60,153,"0","0","0","0","0","0","0","0","0","0","0","0","0","0",15,"0"]
]

Also, in JavaScript, JSON is the default Object Notation, so you don't need to call JSON.parse unless your JSON is being represented as a string.

share|improve this answer

Objects in Javascript can not be presented in such way:

{"0","0",650,"0","0",357,"0","0","0","0",200,"0",48,"0",3053,"0","0","0","0","0",45,50}

An object presentation should have the following format:

{property_name : property_value, ... : ... , ... } 

JSON.parse is expecting ':', but got ','.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.