【发布时间】:2018-07-18 05:23:38
【问题描述】:
我是 json 新手,我想从链接中获取 json 数据,这里来自网络搜索我已经编写了代码
private void button1_Click(object sender, EventArgs e)
{
string url = @"http://hololens5.northeurope.cloudapp.azure.com/INTERSHOP/web/WFS/inSPIRED-inTRONICS_Business-Site/en_US/-/USD/ViewProduct-Start?SKU=1599925&CategoryName=151&CatalogID=Computers";
using (WebClient wc=new WebClient())
{
json = wc.DownloadString(url);
}
string path = @"ouptputfileJSON.json";
if (!File.Exists(path))
{
using (StreamWriter sw = File.CreateText(path))
{
sw.WriteLine(json);
}
}
}
当我执行此代码时,我会在 html 页面中获得输出。如何在提供的链接中获取所选产品的 json 数据
【问题讨论】: