I'm trying to show data read from a JSON file onto HTML page using javaScript. I'm using following code -

```
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>JSON Test</title>
</head>
<body>
    <div id="myData"></div>
    <script>
        fetch('people.json')
            .then(function (response) {
                return response.json();
            })
            .then(function (data) {
                appendData(data);
            })
            .catch(function (err) {
                console.log('error: ' + err);
            });
        function appendData(data) {
            var mainContainer = document.getElementById("myData");
            for (var i = 0; i < data.length; i++) {
                var div = document.createElement("div");
                div.innerHTML = 'Name: ' + data[i].name + ' ' + data[i].city;
                mainContainer.appendChild(div);
            }
        }
    </script>
</body>
</html>

```

By using javaScript I want to create multiple div tags inside div tag under body with id=myData.
For example - I want to have

```
<div id="myData">
     <div></div>         <!-- This for name from JSON file -->
     <div></div>         <!-- This for city from JSON file -->
</div>

```

I've tried multiple methods but none is working. Any help??