Using jQuery:

var str = '{"id":1,"name":"Test1"},{"id":2,"name":"Test2"}';
var jsonObj = $.parseJSON('[' + str + ']');

jsonObj is your JSON object.

Answer from darioo on Stack Overflow
Discussions

javascript - Convert JSON string into an array - Stack Overflow
Is it something possible? It's basically an array of objects that I need for my application. If you are wondering, the json string contains objects on a canvas. ... That's exactly what you should get if you call console.log(resultArray.toString()). More on stackoverflow.com
๐ŸŒ stackoverflow.com
Converting JSON value into JavaScript array - Stack Overflow
I want to convert a JSON string into a set of array containing the values from the JSON. after json.stringify(jsonmybe) and alert it display [{"role":"noi_user"},{"role":"bert_user"}] (which i saw as a JSON). I want to get the noi_user and bert_user and set them into a javascript array. something like ['noi_user','bert_user'] with quotes in each value. I did the var stringy = json.parse() and the alert showing [object ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
javascript - Convert String to Array of JSON Objects (Node.js) - Stack Overflow
I'm using Node.js and express (3.x). I have to provide an API for a mac client and from a post request I extract the correct fields. (The use of request.param is mandatory) But the fields should be More on stackoverflow.com
๐ŸŒ stackoverflow.com
How to convert JSON object to JavaScript array? - Stack Overflow
I need to convert JSON object string to a JavaScript array. More on stackoverflow.com
๐ŸŒ stackoverflow.com
Top answer
1 of 3
54

If you have a JS array of JSON objects:

var s=['{"Select":"11","PhotoCount":"12"}','{"Select":"21","PhotoCount":"22"}'];

and you want an array of objects:

// JavaScript array of JavaScript objects
var objs = s.map(JSON.parse);

// ...or for older browsers
var objs=[];
for (var i=s.length;i--;) objs[i]=JSON.parse(s[i]);

// ...or for maximum speed:
var objs = JSON.parse('['+s.join(',')+']');

See the speed tests for browser comparisons.


If you have a single JSON string representing an array of objects:

var s='[{"Select":"11","PhotoCount":"12"},{"Select":"21","PhotoCount":"22"}]';

and you want an array of objects:

// JavaScript array of JavaScript objects
var objs = JSON.parse(s);

If you have an array of objects:

// A JavaScript array of JavaScript objects
var s = [{"Select":"11", "PhotoCount":"12"},{"Select":"21", "PhotoCount":"22"}];

โ€ฆand you want JSON representation for it, then:

// JSON string representing an array of objects
var json = JSON.stringify(s);

โ€ฆor if you want a JavaScript array of JSON strings, then:

// JavaScript array of strings (that are each a JSON object)
var jsons = s.map(JSON.stringify);

// ...or for older browsers
var jsons=[];
for (var i=s.length;i--;) jsons[i]=JSON.stringify(s[i]);
2 of 3
7
var json = jQuery.parseJSON(s); //If you have jQuery.

Since the comment looks cluttered, please use the parse function after enclosing those square brackets inside the quotes.

var s=['{"Select":"11","PhotoCount":"12"}','{"Select":"21","PhotoCount":"22"}'];

Change the above code to

var s='[{"Select":"11","PhotoCount":"12"},{"Select":"21","PhotoCount":"22"}]';

Eg:

$(document).ready(function() {
    var s= '[{"Select":"11","PhotoCount":"12"},{"Select":"21","PhotoCount":"22"}]';

    s = jQuery.parseJSON(s);

    alert( s[0]["Select"] );
});

And then use the parse function. It'll surely work.

EDIT :Extremely sorry that I gave the wrong function name. it's jQuery.parseJSON

Jquery

The json api

Edit (30 April 2020):

Editing since I got an upvote for this answer. There's a browser native function available instead of JQuery (for nonJQuery users), JSON.parse("<json string here>")

๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ javascript โ€บ how-to-convert-string-to-array-of-objects-javascript
How to Convert String to Array of Objects JavaScript ? - GeeksforGeeks
August 5, 2025 - Another approach to convert a string to an array of objects is to use custom delimiters and object construction. This method is particularly useful when the string format doesn't follow a strict JSON structure but contains well-defined patterns or delimiters.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ article โ€บ how-to-convert-json-string-to-array-of-json-objects-using-javascript
How to Convert JSON String to Array of JSON Objects Using JavaScript?
March 15, 2026 - JSON.parse() is the recommended approach for converting JSON strings to arrays of objects due to its safety, performance, and reliability.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ javascript โ€บ how-to-convert-string-of-objects-to-array-in-javascript
How to Convert String of Objects to Array in JavaScript ? - GeeksforGeeks
July 23, 2025 - The most common and straightforward way to convert a string of objects to an array of objects is by using JSON.parse() method. This method parses a JSON string into a JavaScript object or array.
Find elsewhere
๐ŸŒ
SitePoint
sitepoint.com โ€บ blog โ€บ javascript โ€บ jquery convert json string to array
jquery convert json string to array โ€” SitePoint
February 12, 2024 - Simple jQuery snippet to convert JSON string to an array of objects and then interate output of thier values. var data = JQUERY4U.DASHBOARD.data['widgets']; data = $.parseJSON(data); $.each(data, function (i,v) { console.log(i,v); }); ... To simply convert json to array, as of jquery 1.4.1 ...
๐ŸŒ
xjavascript
xjavascript.com โ€บ blog โ€บ best-way-to-convert-string-to-array-of-object-in-javascript
Best Ways to Convert a String to an Array of Objects in JavaScript: A Practical Guide โ€” xjavascript.com
The approach depends on the stringโ€™s structure: Is it valid JSON? Delimited by commas or semicolons? Does it have a custom pattern? In this guide, weโ€™ll explore the **most practical methods** to convert strings into arrays of objects in JavaScript. Weโ€™ll break down scenarios, provide ...
๐ŸŒ
W3Schools
w3schools.com โ€บ js โ€บ js_json_parse.asp
JavaScript JSON.parse()
After parsing, object properties can be accessed with normal JavaScript syntax. Convert a JSON text into a JavaScript array.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ javascript โ€บ deserializing-a-json-into-a-javascript-object
Deserialize JSON into a JavaScript Object - GeeksforGeeks
September 19, 2026 - After parsing the JSON string, array methods such as forEach() can be used to access each object. Store the JSON array as a string. Use JSON.parse() to convert it into a JavaScript array. Loop through the array to access the properties of each ...
๐ŸŒ
xjavascript
xjavascript.com โ€บ blog โ€บ use-a-json-array-with-objects-with-javascript
How to Loop Through a JSON Array of Objects in JavaScript: Access IDs and Titles โ€” xjavascript.com
Suppose you fetch data from an ... JavaScript" } ] To work with this data in JavaScript, you first parse the JSON string into a JavaScript array using JSON.parse():...
๐ŸŒ
Pluralsight
pluralsight.com โ€บ blog โ€บ tech guides & tutorials
Convert a JSON File to an Array in React | Pluralsight
March 31, 2025 - JSON is a suitable file format ... function parse() converts the string to a JavaScript object, and map() iterates through an array of objects....
๐ŸŒ
Stack Abuse
stackabuse.com โ€บ how-to-convert-json-to-javascript-object
How to Convert JSON to JavaScript Object
October 27, 2023 - An element can be a standalone element, another JSON object or another array, which in turn can contain any of these types as well. Let's take a look at two arrays - a simple one with a few elements, and one that contains several JSON objects: const simpleArrayJson = '["Java", "Python", "JavaScript"]'; const objectArrayJson = '[{"name": "Java", "description": "Java is a class-based, object-oriented programming language."},{"name": "Python", "description": "Python is an interpreted, high-level and general-purpose programming language."}, {"name": "JS", "description": "JS is a programming language that conforms to the ECMAScript specification."}]'; const simpleArray = JSON.parse(simpleArrayJson); const objectArray = JSON.parse(objectArrayJson); console.log(simpleArray); console.log(objectArray);