Multiple changes
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Levi Lab #2</title>
|
||||
<script language="JavaScript" type="text/JavaScript">
|
||||
var json = '{"version":3,"status":"ok","response":{"data":[{"address":"1001 Fanshawe College Blvd","category_ids":[29],"category_labels":["Community and Government","Education","Colleges and Universities"],"country":"ca","factual_id":"fba3ee56-9947-424d-bba4-f6c955491fff","fax":"(519) 452-4420","hours":{"monday":[["6:00","17:00"]],"tuesday":[["6:00","17:00"]],"wednesday":[["6:00","17:00"]],"friday":[["6:00","13:00"]]},"hours_display":"Mon-Wed 6:00-17:00; Fri 6:00-13:00","latitude":43.01392,"locality":"London","longitude":-81.20093,"name":"Fanshawe College","neighborhood":["Huron Heights"],"postcode":"N5Y 5R6","region":"ON","tel":"(519) 452-4430","tel_normalized":"5194524430","website":"http://www.fanshawec.ca","$distance":219.55336},{"address":"1569 Oxford St E","address_extended":"# 1","category_ids":[354,312],"category_labels":["Social","Food and Dining","Restaurants","Diners"],"country":"ca","factual_id":"2b22d57b-6fc3-46c6-b32e-ab6501c0ac15","latitude":43.011113,"locality":"London","longitude":-81.198993,"name":"Careys Pub","neighborhood":["Huron Heights"],"postcode":"N5V 1W5","region":"ON","tel":"(519) 951-6886","tel_normalized":"5199516886","website":"http://careys.ca/","$distance":144.9862},{"address":"1579 Oxford St E","category_ids":[347],"category_labels":["Social","Food and Dining","Restaurants"],"country":"ca","factual_id":"fa5cbbf3-42c4-47bf-af8d-1ff597668820","latitude":43.011228,"locality":"London","longitude":-81.198469,"name":"Tuscanos Pizzeria & Bistro","neighborhood":["Huron Heights"],"postcode":"N5V 1W5","region":"ON","tel":"(519) 452-3737","tel_normalized":"5194523737","website":"http://www.tuscanoslondon.com","$distance":171.85011},{"address":"1569 Oxford St E","category_ids":[363],"category_labels":["Social","Food and Dining","Restaurants","Pizza"],"country":"ca","factual_id":"134b343a-1064-48f8-a8ab-af1c17641a82","latitude":43.011227,"locality":"London","longitude":-81.198942,"name":"Marvellous 2 For 1 Pizza & Wings Inc","neighborhood":["Huron Heights"],"postcode":"N5V 1W5","region":"ON","tel":"(519) 452-1044","tel_normalized":"5194521044","website":"http://marvellous2for1pizza.com/","$distance":139.92738},{"address":"670 1st St","category_ids":[355,464],"category_labels":["Social","Food and Dining","Restaurants","International"],"country":"ca","factual_id":"0bbb20a6-b7ca-4c3c-91c6-2a82cdefcb4c","latitude":43.010551,"locality":"London","longitude":-81.199745,"name":"Sammys Souvlaki","neighborhood":["Huron Heights"],"postcode":"N5V 2A2","region":"ON","tel":"(519) 457-6433","tel_normalized":"5194576433","website":"http://www.restaurantica.com/on/london/sammys-souvlaki/23004725/","$distance":167.32169}],"included_rows":5}}';
|
||||
|
||||
// Convert JSON string to JS object
|
||||
let jsObject = JSON.parse(json);
|
||||
|
||||
// Initialize new variable called viewDate to current date
|
||||
jsObject.viewDate = new Date();
|
||||
|
||||
function startMeUp() {
|
||||
// Print details of each object in the response
|
||||
for (let i = 0; i < jsObject.response.data.length; i++) {
|
||||
document.write(jsObject.response.data[i].name + "<br>");
|
||||
document.write(jsObject.response.data[i].address + "<br>");
|
||||
document.write(jsObject.response.data[i].category_labels.join("<br>") + "<br><br>");
|
||||
}
|
||||
|
||||
// Dump the JSON String after changes
|
||||
document.write(jsonString);
|
||||
}
|
||||
|
||||
// Convert JS object back to JSON string
|
||||
let jsonString = JSON.stringify(jsObject);
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body onload="startMeUp();">
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user