JSON. stringify( ) function in JavaScript

JavascriptHTMLFront End TechnologyJSON

The stringify() function of a JSON object accepts a JSON string, and constructs an object based on the given text and, returns it.

Syntax

Its Syntax is as follows

Json.stringify();

Example

 Live Demo

<html>
<head>
   <title>JavaScript Example</title>
</head>
<body>
   <script type="text/javascript">
      var jsonSample = '{Tutorial: Java, Version:8}';
      jsonObj = JSON.stringify(jsonSample);
      document.write(jsonObj);
   </script>
</body>
</html>

Output

"{Tutorial: Java, Version:8}"
raja
Updated on 25-Jun-2020 12:03:07

Advertisements