top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

How to parse JSON in JQuery?

0 votes
63 views
How to parse JSON in JQuery?
posted Jul 9, 2017 by Ram Jana

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

JQuery provides a metohd called "parseJSON()" which takes a well-formed JSON string and returns the resulting JQuery object.

Syntax

$.parseJSON(text)

Parameters

text
the JSON string.
(return value)
the resulting JQuery object. Undefined if not valid.

Example

var json = '[{"id":"1","tagName":"apple"},{"id":"2","tagName":"orange"},
{"id":"3","tagName":"banana"},{"id":"4","tagName":"watermelon"},
{"id":"5","tagName":"pineapple"}]';

$.each($.parseJSON(json), function(idx, obj) {
    alert(obj.tagName);
});
answer Jul 10, 2017 by Shyam Chakraborty
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...