<!DOCTYPE html>
<html>
<body>
<h2>JSON Object Creation in JavaScript</h2>
<p>
Name: <span id="jname"></span><br />
Eval Name: <span id="evalname"></span><br />
<p>
<script>
var yyyy= {
"name":"John Johnson",
"street":"Oslo West 555",
"age":33,
"phone":"555 1234567"};
document.getElementById("jname").innerHTML = yyyy.name;
document.getElementById("evalname").innerHTML = eval(yyyy).name;
</script>
</body>
</html>
i am getting out put as below this is same with and without eval()
JSON Object Creation in JavaScript
Name: John Johnson
Eval Name: John Johnson
yyyyisn’t JSON. It’s a JavaScript object. So in this case, you don’t needevalwhatsoever. When you deal with JSON, you should useJSON.parseinstead ofeval.evalsimply returns the object you passed to it, without modifying it. So it’s superfluous here.