【发布时间】:2016-01-12 15:58:55
【问题描述】:
我的代码是这样的
$username = "username"
$password = "password"
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username,$password)))
$response = Invoke-RestMethod -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -Uri https://api.bitbucket.org/2.0/teams/Ateam/members -Method Get
$new = $response |select Values
$new
$new|Export-Csv C:\Users\helloworld\Desktop\BitBucket\Ateam.team.csv -NoTypeInformation
当我执行这个脚本时,我可以在我的 Powershell Board 上看到像这样的“Values”的内部。
values
------
{@{username=helloworld; website=; display_name=rhelloworld; uuid ={dewi3urgfj-.
但我检查了我的 csv,它是这样写的
values
System.Object[]
我也想像这样在我的 csv 上显示,
{@{username=helloworld; website=; display_name=rhelloworld; uuid ={dewi3urgfj-.
当我执行“$new”时,如何在 csv 中显示“System Object[]”的内部?
【问题讨论】:
-
你试过
ConvertFrom-Json吗?
标签: json csv powershell