<script>
<!DOCTYPE html>
<html>
<head>
<title>Json Encode</title>
</head>
<body>
<script type="text/javascript">
var obj = {
id:1,
name:'John',
address:'Silicon Valley'
}
var objEncode = JSON.stringify(obj);
console.log(objEncode);
</script>
</body>
</html>
</script>