I know how to do it for fetching and displaying XML, and tought it would be easy to convert this code to fetch json instead, but I can´t get it to work.
Here is what I have for XML, and this works perfectly.
@using System.Xml.Linq
@using System.Xml
@using System.Linq
@{
XmlDocument xml = new XmlDocument();
xml.Load("http://www.www.com/myfeed");
XmlNodeList nodes = xml.SelectNodes("//Observation");
}
<!doctype html>
<html lang="fo">
<head>
</head>
<body>
@foreach(XmlNode node in nodes)
{
var stationid = node.SelectSingleNode("StationId").InnerText;
var stationname = node.SelectSingleNode("StationName").InnerText;
var date = node.SelectSingleNode("Date").InnerText;
var time = node.SelectSingleNode("Time").InnerText;
var lat = node.SelectSingleNode("Lat").InnerText;
var longitude = node.SelectSingleNode("Long").InnerText;
var avgwind = node.SelectSingleNode("AvgWind").InnerText;
var maxwind = node.SelectSingleNode("MaxWind").InnerText;
var winddir = node.SelectSingleNode("WindDir").InnerText;
var temperature = node.SelectSingleNode("Temperature").InnerText;
var roadtemperature = node.SelectSingleNode("RoadTemperature").InnerText;
var pressure = node.SelectSingleNode("Pressure").InnerText;
var humidity = node.SelectSingleNode("Humidity").InnerText;
var rainintensity = node.SelectSingleNode("RainIntensity").InnerText;
var cloudstatus = node.SelectSingleNode("CloudStatus").InnerText;
var roadstatus = node.SelectSingleNode("RoadStatus").InnerText;
var windwarning = node.SelectSingleNode("WindWarning").InnerText;
var f_link = node.SelectSingleNode("F_Link").InnerText;
<text>
stationid - @stationid <br /><br />
stationname - @stationname <br /><br />
date - @date <br /><br />
time - @time <br /><br />
lat - @lat <br /><br />
longitude - @longitude <br /><br />
avgwind - @avgwind <br /><br />
maxwind - @maxwind <br /><br />
winddir - @winddir <br /><br />
temperature - @temperature <br /><br />
roadtemperature @roadtemperature <br /><br />
pressure - @pressure <br /><br />
humidity - @humidity <br /><br />
rainintensity - @rainintensity <br /><br />
cloudstatus - @cloudstatus <br /><br />
roadstatus - @roadstatus <br /><br />
windwarning - @windwarning <br /><br />
f_link - @f_link <br /><br />
<hr />
<br /><br />
</text>
}