■ ConvertFrom-Json 명령을 사용해 JSON 파일을 파싱하는 방법을 보여준다.
▶ setting.json
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
{ "MainFormLeft" : 52, "MainFormTop" : 52, "MainFormWidth" : 920, "MainFormHeight" : 690, "MainFormState" : "Maximized", "SkinStyle" : "The Bezier", "RibbonMinimized" : true, "SidebarStyle" : "NavigationPane", "SidebarWidth" : 100, "SidebarCollapsable" : false, "SidebarVisible" : true } |
▶ 실행 명령
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
$JSON = (Get-Content "d:\test.json" -Encoding UTF8 | Out-String) $Setting = ConvertFrom-Json $JSON $Setting.MainFormLeft $Setting.MainFormTop $Setting.MainFormWidth $Setting.MainFormHeight $Setting.MainFormState $Setting.SkinStyle $Setting.RibbonMinimized $Setting.SidebarStyle $Setting.SidebarWidth $Setting.SidebarCollapsable $Setting.SidebarVisible |