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
๐ŸŒ
MDN Web Docs
developer.mozilla.org โ€บ en-US โ€บ docs โ€บ Web โ€บ JavaScript โ€บ Reference โ€บ Global_Objects โ€บ JSON โ€บ parse
JSON.parse() - JavaScript | MDN
Because JSON has no syntax space for annotating type metadata, in order to revive values that are not plain objects, you have to consider one of the following: Serialize the entire object to a string and prefix it with a type tag. "Guess" based on the structure of the data (for example, an ...
๐ŸŒ
W3Schools
w3schools.com โ€บ js โ€บ js_json_parse.asp
JSON.parse()
AJAX Intro AJAX XMLHttp AJAX Request AJAX Response AJAX XML File AJAX PHP AJAX ASP AJAX Database AJAX Applications AJAX Examples JS JSON ยท JSON Intro JSON Syntax JSON vs XML JSON Data Types JSON Parse JSON Stringify JSON Objects JSON Arrays JSON Server JSON PHP JSON HTML JSON JSONP JS jQuery
๐ŸŒ
MDN Web Docs
developer.mozilla.org โ€บ en-US โ€บ docs โ€บ Web โ€บ JavaScript โ€บ Reference โ€บ Global_Objects โ€บ JSON โ€บ stringify
JSON.stringify() - JavaScript | MDN
The JSON.stringify() static method converts a JavaScript value to a JSON string, optionally replacing values if a replacer function is specified or optionally including only the specified properties if a replacer array is specified.
๐ŸŒ
W3Schools
w3schools.com โ€บ js โ€บ js_json_stringify.asp
JSON.stringify()
You will learn how to send JSON to a server in the next chapters. It is also possible to stringify JavaScript arrays:
Find elsewhere
๐ŸŒ
ReqBin
reqbin.com โ€บ code โ€บ javascript โ€บ n2ek7onb โ€บ javascript-array-to-json-example
How do I convert JavaScript array to JSON?
To convert a JavaScript array to a JSON data string, you can use the JSON.stringify(value, replacer, space) method. The optional replacer parameter is a function that can alter the behavior of the serialization process.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ how-to-convert-json-string-to-array-of-json-objects-using-javascript
How to Convert JSON String to Array of JSON Objects Using JavaScript?
In this approach we have used Function constructor to convert JSON string to array of JSON objects using JavaScript. We have used a button that triggers convert() function and initialized a JSON string which is stored in variable jsonString.
๐ŸŒ
Pluralsight
pluralsight.com โ€บ tech insights & how-to guides โ€บ tech guides & tutorials
Convert Strings to JSON Objects in JavaScript with eval() | Pluralsight
March 31, 2025 - String data can be easily converted to JSON using the stringify() function, and also it can be done using eval(), which accepts the JavaScript expression that you will learn about in this guide.
๐ŸŒ
SitePoint
sitepoint.com โ€บ blog โ€บ javascript โ€บ jquery convert json string to array
jquery convert json string to array โ€” SitePoint
February 12, 2024 - In JavaScript, you can use the JSON.parse() method to convert a JSON string into an array.
๐ŸŒ
ConvertSimple
convertsimple.com โ€บ convert-javascript-to-json
Convert Javascript Object to JSON Online - ConvertSimple.com
October 17, 2020 - Convert a JavaScript object or array to JSON format with this simple online JavaScript to JSON converter tool.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ javascript-convert-an-array-to-json
Convert an Array to JSON in JavaScript | GeeksforGeeks
October 7, 2024 - This method converts the javascript Object(array in this case) into JSON_string. ... Example 1: This example converts the JS array to JSON String using JSON.stringify() method.
๐ŸŒ
JavaScript.info
javascript.info โ€บ tutorial โ€บ the javascript language โ€บ data types
JSON methods, toJSON
JSON supports plain objects, arrays, strings, numbers, booleans, and null. JavaScript provides methods JSON.stringify to serialize into JSON and JSON.parse to read from JSON.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ javascript-convert-an-array-to-json
JavaScript Convert an array to JSON
In the above program, firstly, we declare an array with a fixed size and then we initialize the value. And by using for loop we print the array elements. We then used JSON.stringify(array) method to convert an array to JSON and pass an array as an argument of the method.