JavaScript
Article

jquery convert json string to array

By Sam Deering

Simple jQuery snippet to convert JSON string to an array of objects and then interate output of thier values.

jquery convert json string to array

var data = JQUERY4U.DASHBOARD.data['widgets'];
data = $.parseJSON(data);
$.each(data, function (i,v)
{
  console.log(i,v);
});

Then to convert back simply use stringify:

$('#columns').html(data.stringify);

jquery convert json string to array2

To simply convert json to array, as of jquery 1.4.1 you can do this natively.

  • Prudhvi Raju

    hai this prudhvi hey i want json data to convert into string in javascript can u help me using a single id h

Recommended
Sponsors
Because We Like You
Free Ebooks!

Grab SitePoint's top 10 web dev and design ebooks, completely free!

Get the latest in JavaScript, once a week, for free.