【发布时间】:2014-06-23 17:52:38
【问题描述】:
我正在尝试向控制台输出一个在我调用 URL 时返回的 json 对象:
http://localhost:999/api/randomObjects/19
其中 randomObjects 是对象的类型,19 是对象 ID。到目前为止,我在 powershell 中将 json 输出到控制台的唯一方法是使用 webclient 并将 json 保存到文件夹然后输出。
$storageDir = "C:\Path\to\folder"
$webclient = New-Object System.Net.WebClient
$url = "http://localhost:999/api/randomObjects/19"
$file = "$storageDir/demofile.json"
$webclient.DownloadFile($url,$file)
cat $file
有没有办法直接将json对象输出到控制台而不保存在文件中?
【问题讨论】:
标签: json http rest powershell