json stringify

Updated at 11-Jan-2021, By samar

json stringify

Hello everyone, in this post we will examine how to solve the "json stringify" programming puzzle.

  • <script> 
    var obj = {a: "a", b: "b" /*...*/};
    var string = JSON.stringify(obj);
    </script>
    <!-- OUTPUT -->
    "{'a':'a', 'b':'b'}"
    
  • <script> 
    var obj = { name: "John", age: 30, city: "New York" };
    var myJSON = JSON.stringify(obj); 
    </script>
    

Back to code snippet queries related javascript