iT邦幫忙

0

powershell 編輯json檔

kbin 2020-08-25 16:01:031501 瀏覽
  • 分享至 

  • xImage

請問各位大大
json檔可以用txt那麼容易編輯嗎
可以的話能不能提供新增 更改 刪除的指令教學

個人喜好用visual Code(免費)編輯 ,按ctrl + shift + X 輸入 json Editor ...按下安裝

打開json檔之後就能用shift + alt + F 鍵對json檔排版給人看
froce iT邦大師 1 級 ‧ 2020-08-25 17:44:22 檢舉
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/convertfrom-json?view=powershell-7
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

2 個回答

0
player
iT邦大師 1 級 ‧ 2020-08-25 17:14:05

1.powershell 呼叫 .NET架構的dll檔,你會用嗎?
https://stackoverflow.com/questions/13968004/how-do-i-use-json-net-to-parse-json-in-powershell

2.如果會的話,到NuGet那邊找個JSON的套件來用

https://www.nuget.org/packages/Newtonsoft.Json/

kbin iT邦新手 5 級 ‧ 2020-08-31 18:09:30 檢舉

感謝大神
後來我用Get-Content 6004.json | ComvertfroM-Json
把json檔變成自定義的方式就可以做到整行刪除跟新增
還在思考看能不能做到只有中間幾個字元去做更換

我要發表回答

立即登入回答