MalTec
MalTec

Reputation: 1370

JSONArray with jquery

I have JSONArray Containing JSONObjects

[ { 'title': abc,  'details':xyz,}, {'title': abc2,'details':xyz2}]

How to parse it using jquery?

Upvotes: 0

Views: 429

Answers (2)

Belinda
Belinda

Reputation: 1231

parseJSON will convert your Json string into a javascript object. The code is something like

var array = $.parseJSON(json);

Then to access the variables you use code like

var title1 = array[0].title;  //title1 is abc

Upvotes: 1

Thinker
Thinker

Reputation: 14464

I think you need to use parseJSON if your array is a string.

http://api.jquery.com/jQuery.parseJSON/

Upvotes: 0

Related Questions