Result Size: 625 x 534
x
 
<!DOCTYPE html>
<html>
<body>
<p>如何访问嵌套的 JSON 对象。</p>
<p id="demo"></p>
<script>
var myObj = {
  "name":"John",
  "age":30,
  "cars": {
  "car1":"Ford",
  "car2":"BMW",
  "car3":"Fiat"
  }
}
document.getElementById("demo").innerHTML += myObj.cars.car2 + "<br>";
//or:
document.getElementById("demo").innerHTML += myObj.cars["car2"];
</script>
</body>
</html>