【文件属性】:
文件名称:Powershell中请求WebServices并以JSON格式输出结果
文件大小:38KB
文件格式:PDF
更新时间:2021-01-20 16:28:31
c ce ice
适用于PS3.0及以后版本。
这里可以用JSON格式从网上得到大量的信息,下面例子演示如何将网上查到的结果转换成JSON对象。
这个例子使用了一个德国铁路公司的网站,你可以输入一个火车站的名字或城市,他将返回你想要去的类似所有车站名称。
代码如下:
# ask for part of the train station name
$name = Read-Host ‘Enter part of train station Name’
# query webservice
$url = “http://openbahnapi.appspot.com/rest/stations/list?c