8
我有這樣的JSON在一個名爲test.txt的ConvertFrom JSON的PowerShell命令不解析整個JSON對象
{
"local-dev": {
"client": {
"server-url": "http://localhost:3000"
},
"server": {
"renterEndpoint": {
"rejectUnauthorized": false,
"host": "blah.blah.com",
"port": 443,
"path": "/api/renter"
},
"homeownerEndpoint": {
"rejectUnauthorized": false,
"host": "blah.blah.com",
"port": 443,
"path": "/api/homeowner"
}
}
}
}
當我運行此PowerShell命令:
Get-Content "test.txt" -Raw | ConvertFrom-Json
的出來把我弄不包括第二級下的任何對象(即客戶端和服務器對象沒有屬性)。
local-dev
---------
@{client=; server=}
任何人有什麼想法?
謝謝馬特!數據在那裏並不明顯。 – dprothero 2014-11-25 03:32:31
@dprothero同意。只是好像它必須在那裏:) – Matt 2014-11-25 03:33:15
好的答案..僅供參考,已經被咬了自己,我用一個技巧來確認這些事情..'ConvertTo-Json $ json -Depth 10',它會顯示正確的和整個結構(深度10,可以使用更高的數字),很好地格式化。 – 2014-11-26 01:58:02