Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <h2>Create a JSON string from a JavaScript array.</h2> <p id="demo"></p> <script> const arr = ["John", "Peter", "Sally", "Jane"]; const myJSON = JSON.stringify(arr); document.getElementById("demo").innerHTML = myJSON; </script> </body> </html>