-1

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

Blu
  • 4,036
  • 6
  • 38
  • 65

2 Answers2

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
  • 1
    JSON 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
  • how i can get id or clubid? – Blu May 27 '13 at 08:15
  • @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
  • @LightStyle yes u right it is response – Blu May 27 '13 at 08:17
  • @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