json - 从 C# 中的 URL 获取 Json 数据
问题描述
我是 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 数据
解决方案
这是您正在寻找的其余端点:
http://hololens5.northeurope.cloudapp.azure.com/INTERSHOP/rest/WFS/inSPIRED-
inTRONICS_Business-Site/-;loc=en_US;cur=USD/products/1599925
有关其他休息端点的文档:https: //support.intershop.com/kb/index.php/Display/T27711
推荐阅读
- java - 空指针指向方法 getItemCount。我应该初始化那个方法吗?
- fastlane - Fastlane:使用设备更新更新匹配配置文件
- nestjs - 无法在会话变量中设置未定义的属性“userId”
- python - 表单不会验证,说所有字段都是空的 Django
- python - Python OpenCV - 图像四肢计算
- python - python中指数投资组合的跨度
- python - 有什么方法可以在 Python tkinter gui 中按比例放大点(x,y)?
- c# - C# 求函数的逆
- rescript - 使用 CLI 编译 Rescript -- 没有 bsconfig.json
- awk - Replace each nth occurrence of 'foo' and 'bar' by numerically respective nth line of a supplied file once time