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 =['widgets'];
data = $.parseJSON(data);
$.each(data, function (i,v)

Then to convert back simply use 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



Learn Coding Online
Learn Web Development

Start learning web development and design for free with SitePoint Premium!

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