VisualStudio 2015 Universal app .NET parse json -
how in visualstudio 2015 (net framewortk 4.5.2) downbload , parse json?
url json is: http://api.sunrise-sunset.org/json?lat=36.7201600&lng=-4.4203400
it not necessary parse building. values sunrise , sunset
thank you
there 2 nuget packages make easy. httpclient (package name microsoft.net.http) request. json.net (package name newtonsoft.json) make easy deserialize json. allow this:
using (httpclient hclient = new httpclient()) { httpresponsemessage response = await hclient.getasync(url); string strcontent = await response.content.readasstringasync(); return jsonconvert.deserializeobject<yourtypehere>(strcontent); }
Comments
Post a Comment