You can use JSON.parse:

JSON.parse('[{ "qty" : "2","name" : "ice cream","price" : "25"},{ "qty" : "5","name" : "biriyani","price" : "250"},{ "qty" : "1","name" : "kappa","price" : "50"}]')

Notice that I addded square brackets around your string since there are three objects in it.

Answer from Shai on Stack Overflow
🌐
DEV Community
dev.to β€Ί speaklouder β€Ί 4-ways-to-convert-string-to-character-array-in-javascript-3en
4 Ways to Convert String to Character Array in JavaScript - DEV Community
October 5, 2023 - By looping through each character in the string and pushing it into an array, we create our character array. JavaScript's Array.from() method is a versatile way to create an array from an iterable object, including a string.
🌐
SamanthaMing
samanthaming.com β€Ί tidbits β€Ί 83-4-ways-to-convert-string-to-character-array
4 Ways to Convert String to Character Array in JavaScript | SamanthaMing.com
Here are 4 ways to split a word into an array of characters. "Split" is the most common and more robust way. But with the addition of ES6, there are more tools in the JS arsenal to play with 🧰 Β· I always like to see all the possible ways to solve something because then you can choose the best way for your use case. Also, when you see it pop up in someone's codebase, you will understand it with ease πŸ‘β€¬ Β· const string = 'word'; // Option 1 string.split(''); // Option 2 [...string]; // Option 3 Array.from(string); // Option 4 Object.assign([], string); // Result: // ['w', 'o', 'r', 'd']
🌐
GeeksforGeeks
geeksforgeeks.org β€Ί javascript β€Ί how-to-get-character-array-from-string-in-javascript
JavaScript - How to Get Character Array from String? - GeeksforGeeks
July 11, 2025 - In the case of a string, it breaks string to character and we capture all the characters of a string in an array. ... The Array.from() method creates a new array instance from a given array.
Top answer
1 of 16
567

Note: This is not unicode compliant. "IU".split('') results in the 4 character array ["I", "οΏ½", "οΏ½", "u"] which can lead to dangerous bugs. See answers below for safe alternatives.

Just split it by an empty string.

var output = "Hello world!".split('');
console.log(output);

See the String.prototype.split() MDN docs.

2 of 16
454

As hippietrail suggests, meder's answer can break surrogate pairs and misinterpret β€œcharacters.” For example:

// DO NOT USE THIS!
const a = 'πŸ˜πŸ™πŸšπŸ›'.split('');
console.log(a);
// Output: ["οΏ½","οΏ½","οΏ½","οΏ½","οΏ½","οΏ½","οΏ½","οΏ½"]

I suggest using one of the following ES2015 features to correctly handle these character sequences.

Spread syntax (already answered by insertusernamehere)

const a = [...'πŸ˜πŸ™πŸšπŸ›'];
console.log(a);

Array.from

const a = Array.from('πŸ˜πŸ™πŸšπŸ›');
console.log(a);

RegExp u flag

const a = 'πŸ˜πŸ™πŸšπŸ›'.split(/(?=[\s\S])/u);
console.log(a);

Use /(?=[\s\S])/u instead of /(?=.)/u because . does not match newlines. If you are still in ES5.1 era (or if your browser doesn't handle this regex correctly - like Edge), you can use the following alternative (transpiled by Babel). Note, that Babel tries to also handle unmatched surrogates correctly. However, this doesn't seem to work for unmatched low surrogates.

const a = 'πŸ˜πŸ™πŸšπŸ›'.split(/(?=(?:[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|\uD800-\uDBFF|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]))/);
console.log(a);

A for ... of ... loop

const s = 'πŸ˜πŸ™πŸšπŸ›';
const a = [];
for (const s2 of s) {
   a.push(s2);
}
console.log(a);

🌐
Stack Overflow
stackoverflow.com β€Ί questions β€Ί 25821681 β€Ί convert-a-string-into-a-character-array-using-javascript β€Ί 25821733
html - Convert a string into a character array using JavaScript - Stack Overflow
Copyvar str = 'YNN'; //or whatever var strWithComma = str.split(''); //to char array Β· After this you can join the chars to a new string for display output.
🌐
CoreUI
coreui.io β€Ί answers β€Ί how-to-convert-a-string-to-an-array-in-javascript
How to convert a string to an array in JavaScript Β· CoreUI
September 22, 2025 - Use the split() method to convert a string into an array of characters or words in JavaScript efficiently.
🌐
TutorialsPoint
tutorialspoint.com β€Ί How-do-you-convert-a-string-to-a-character-array-in-JavaScript
How do you Convert a String to a Character Array in JavaScript?
November 21, 2024 - To convert a string to character array in JavaScript, we have used split() method that splits a string object into an array of strings by separating the string into substrings.
Find elsewhere
🌐
ReqBin
reqbin.com β€Ί code β€Ί javascript β€Ί jaarxzpl β€Ί javascript-string-to-array-example
How do I convert string to array in JavaScript?
March 9, 2023 - The Array.from() method in JavaScript is used to create an array from any iterable object. The from() method returns a new array instance whose elements correspond to each element in the iterable.
🌐
Medium
medium.com β€Ί programming-essentials β€Ί 4-ways-of-transforming-a-string-into-an-array-of-characters-8649e3abfd8d
Convert From String to an Array of Characters in JavaScript: 4 Easy Ways | by Cristian Salcescu | Jul, 2021 | | Frontend Essentials
June 6, 2022 - We can convert a string to an array of characters by using the empty string as the separator for the split method. const text = "abc"; const chars = text.split(''); console.log(chars); //['a', 'b', 'c']
🌐
ASPSnippets
aspsnippets.com β€Ί questions β€Ί 646475 β€Ί Convert-string-to-char-Array-using-JavaScript
Convert string to char Array using JavaScript
January 25, 2025 - ... <input type="button" onclick="CharArray()" value="To Array" /> <span id="spnName">ADNAAN</span> <script> function CharArray() { var name = document.getElementById("spnName").innerHTML; var chars = name.split(''); name = ''; for (var i = ...
🌐
Medium
medium.com β€Ί @jsomineni β€Ί 3-ways-to-convert-string-into-array-in-javascript-3eacfc729cf6
3 ways to convert String into Array in JavaScript | by Jayanth babu S | Medium
September 1, 2024 - Use split() when you need to break a string into an array of words or characters, based on a specific delimiter.
🌐
GeeksforGeeks
geeksforgeeks.org β€Ί javascript β€Ί string-to-array-in-javascript
JavaScript - Convert String to Array - GeeksforGeeks
August 5, 2025 - Modify parts of the string (like replacing characters or extracting substrings). Split a string into smaller components for easier processing. The most common method for converting a string to an array is using the split() method.
🌐
Quora
quora.com β€Ί How-do-I-convert-a-string-to-a-char-in-JavaScript
How to convert a string to a char in JavaScript - Quora
Answer (1 of 2): JavaScript does NOT have a char type. With that said, here is the best you can do… First of all, the string s must have a length of 1. let c = s[0] If string s is empty or has more than 1 character in it, you can’t convert ...
🌐
IQCode
iqcode.com β€Ί code β€Ί javascript β€Ί convert-string-to-char-array-javascript
convert string to char array javascript Code Example
September 20, 2021 - const string = 'hi there'; const usingSplit = string.split(''); const usingSpread = [...string]; const usingArrayFrom = Array...
🌐
GeeksforGeeks
geeksforgeeks.org β€Ί how-to-convert-char-to-string-in-javascript
How to Convert Char to String in JavaScript ? | GeeksforGeeks
July 9, 2024 - By spreading the character, it creates an array with the character as its sole element, simplifying the conversion to a string.
🌐
Altcademy
altcademy.com β€Ί blog β€Ί how-to-convert-string-to-array-in-javascript
How to convert string to array in JavaScript - Altcademy.com
June 9, 2023 - By converting a string to an array, you can easily access and manipulate its individual characters, which can make your code more efficient and easier to understand. Now that we have a basic understanding of strings and arrays, let's discuss how to convert a string to an array in JavaScript.
🌐
Flexiple
flexiple.com β€Ί javascript β€Ί string-to-array-javascript
Converting string to array JavaScript? - Flexiple Tutorials - Flexiple
March 11, 2022 - Using the following syntax we can convert strings to arrays in JavaScript. The split() methods take in a delimiter as a parameter and based on the specifying value the string is split.