title: Proper formating of JSON using powershell
body: <p>I have a following file in JSON format:</p>
  
  <p>Before <code>ConvertTo-JSON</code>:</p>
  
  <pre><code>[
      {
          "Yura": {
              "Cashier": {
                  "branch": "release/Retail-v4.0",
                  "configuration": "RetailDemo Debug",
                  "datetime_deployed": "Apr 18 2018 07:45:05",
                  "deployed_by": "anonymous",
                  "host": "cashier2-retail4.testing.aws.com",
                  "job": "http://jenkins-testing.aws.com:8080/job/CashierDeployment",
                  "lineserver": "",
                  "messagebus": "",
                  "product": "Cashier",
                  "publish_profile": "cashier2.retail.dev.pubxml"
              },
              "ContentManager": {
                  "branch": "release/Retail-v3.31.1",
                  "configuration": "RetailDemo Debug",
                  "datetime_deployed": "Jan 17 2018 11:59:24",
                  "deployed_by": "anonymous",
                  "host": "contentmanager2-retail3.testing.aws.com",
                  "job": "http://jenkins-testing.aws.com:8080/job/ContentManagerDeployment",
                  "lineserver": "",
                  "messagebus": "",
                  "product": "ContentManager",
                  "publish_profile": "..\\ContentManager.PublishProfiles\\contentmanager2.retail5.dev.pubxml"
              }
          }
      }
  ]
  </code></pre>
  
  <p>after using this code for manipulation with data:</p>
  
  <pre><code>$json = Get-Content 'D:\script\test.json'  -encoding utf8 | ConvertFrom-Json
  $json.yura.ContentManager.branch = 'test'
  </code></pre>
  
  <p>I save JSON into another file:</p>
  
  <pre><code>$json | convertto-json | set-content "D:\script\test1.json" -encoding utf8
  </code></pre>
  
  <p>Problem is, that after saving file, format become broken:</p>
  
  <pre><code>{
      "Yura":  {
                   "Cashier":  {
                                   "branch":  "release/Retail-v4.0",
                                   "configuration":  "RetailDemo Debug",
                                   "datetime_deployed":  "Apr 18 2018 07:45:05",
                                   "deployed_by":  "anonymous",
                                   "host":  "cashier2-retail4.testing.aws.com",
                                   "job":  "http://jenkins-testing.aws.com:8080/job/CashierDeployment",
                                   "lineserver":  "",
                                   "messagebus":  "",
                                   "product":  "Cashier",
                                   "publish_profile":  "cashier2.retail.dev.pubxml"
                               },
                   "ContentManager":  {
                                          "branch":  "test",
                                          "configuration":  "RetailDemo Debug",
                                          "datetime_deployed":  "Jan 17 2018 11:59:24",
                                          "deployed_by":  "anonymous",
                                          "host":  "contentmanager2-retail3.testing.aws.com",
                                          "job":  "http://jenkins-testing.aws.com:8080/job/ContentManagerDeployment",
                                          "lineserver":  "",
                                          "messagebus":  "",
                                          "product":  "ContentManager",
                                          "publish_profile":  "..\\ContentManager.PublishProfiles\\contentmanager2.retail5.dev.pubxml"
                                      }
               }
  }
  </code></pre>
  
  <p>My question is - how to preserve source formatting in PowerShell?</p>