I want to parse this {"success":"true","data":[{"id":"15","clubid":"20","priority":"1"}]
and i want to parse it so i can get values
Help me in this
Asked
Active
Viewed 63 times
-1

Blu
- 4,036
- 6
- 38
- 65
-
1... and the problem is what? `JSON.parse()` will be your friend! – Sirko May 27 '13 at 08:08
-
https://www.google.com/search?q=jquery+parse+json – terafor May 27 '13 at 08:10
-
thanks to @all solved by using this http://stackoverflow.com/questions/11922383/access-process-nested-objects-arrays-or-json – Blu May 27 '13 at 08:34
2 Answers
1
Your JSON isn't valid, anyway if it is only a typo(which is possible), JSON.parse(string)
is the function you're looking for!

Niccolò Campolungo
- 11,824
- 4
- 32
- 39
1
You won't even need to force a Parse if your JSON is valid.
If you have an object assigned to this data, for example:
var data = {}
You could most probably already access your data by referencing:
data.success

Bjorn 'Bjeaurn' S
- 3,861
- 2
- 18
- 29
-
If it is a response then it will be a string, then you have to parse it. Or am I wrong? – Niccolò Campolungo May 27 '13 at 08:13
-
1JSON is a textual data-exchange format. If you receive it via Ajax (for example), you have to parse it. – Felix Kling May 27 '13 at 08:13
-
-
@BluAngel: [Access / process (nested) objects, arrays or JSON](http://stackoverflow.com/q/11922383/218196). I also recommend to read a JavaScript tutorial, e.g. https://developer.mozilla.org/en/docs/JavaScript/Guide/Working_with_objects. – Felix Kling May 27 '13 at 08:16
-
-
@BluAngel exactly what Felix Kling referenced you to. You should consider reading up on some basic Javascript, especially objects within Javascript. In your case; try data.id and data.clubid. – Bjorn 'Bjeaurn' S May 27 '13 at 08:17