Looking to convert a JSON Object to javascript code. I have a JSON data with 2 columns, and I need to iterate through both columns. Any assistance would be greatly appreciated.
{
"hotels": {
"1":{"name": "Taj Residency","description":" Sample description of Taj" },
"2":{"name": "Gulf Zone","description":" Sample description of Gulf Zone"},
"3":{"name": "Silver Resort","description":" Sample description of Silver Resort"},
"4":{"name": "Burj Al Arab","description":" Sample description of Burj Al Arab "},
"5":{"name": "Raffles Dubai","description":" Sample description of Raffles Dubai"},
"6":{"name": "Dubai Heights","description":" Sample description of Dubai Heights"},
"7":{"name": "Classic Tower","description":" Sample description of Classic Tower"},
"8":{"name": "Royal","description":" Sample description of Royal"},
"9":{"name": "Al Arab Residency","description":" Sample description of Al Arab Residency"}
},
"location": {
"1":{"name": "Dubai" },
"2":{"name": "Sharjah"},
"3":{"name": "Abu Dhabi"},
"4":{"name": "Mumbai"}
}
}
I have successfully output the data in the console but struggling to display it in the browser.
Please review the code below.
<html>
<head>
<title>Assi</title>
<meta charset="utf-8" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
$(document).ready(function () {
$.ajax({
type: 'GET',
url: 'jSon.json',
data: '',
dataType: 'json',
success: function (response) {
console.log(response);
}
});
})
</script>
</head>
<body>
</body>
</html>