Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body>
- <h2>Create JSON string from a JavaScript object.</h2>
- <p id="demo"></p>
- <script>
- var obj = { name: "John", age: 30, city: "New York" };
- var myJSON = JSON.stringify(obj);
- document.getElementById("demo").innerHTML = myJSON;
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement