Agyan
adda
Run
Reset
Copy
JavaScript Tutorial › JS JSON › stringify and parse
Back to tutorial
Code
Edit, then press Run or Ctrl+Enter
<pre id="out"></pre> <script> const course = { title: 'JavaScript', topics: 40, free: true, tags: ['web', 'frontend'] }; const text = JSON.stringify(course, null, 2); const back = JSON.parse(text); document.getElementById('out').textContent = 'As JSON text:\n' + text + '\n\nParsed back – title: ' + back.title + ', type: ' + typeof back; </script>
Result