title: How to convert text file into json file using powerShell
body: <p>Below is the auto generated text file raw content.</p>
  <pre><code>Application Name: XKHGKSGHXSNBXS
  Secret Key:       NDRkNDJjOTAtZjBhYi00NmMyLWJlMzctYjkwYTNlMjNmZTQy=
  Application Name: HVABSVGJCXJGsx
  Secret Key:       OTlmMmMxYjgtZjEzMS00MTkwLWI1NDQtYjI2MTc1MTk1ZTkz=
  Application Name: khsxsvxhjvsGJJHJ
  Secret Key:       NDRkNDJjOTAtZjBhYi00NmMyLWJlMzctYjkwYTNlMjNmZTQy=
  Application Name: HDFACVXJAGSV
  Secret Key:       OTlmMmMxYjgtZjEzMS00MTkwLWI1NDQtYjI2MTc1MTk1ZTkz=
  Application Name: WCVDACsBHBHvsx
  Secret Key:       NDRkNDJjOTAtZjBhYi00NmMyLWJlMzctYjkwYTNlMjNmZTQy=
  Application Name: 90GVASXSACVSA
  Secret Key:       OTlmMmMxYjgtZjEzMS00MTkwLWI1NDQtYjI2MTc1MTk1ZTkz=
  Application Name: NBSANX0067Jtudent
  Secret Key:       NDRkNDJjOTAtZjBhYi00NmMyLWJlMzctYjkwYTNlMjNmZTQy=
  Application Name: ABNSVXNBSXdfert
  Secret Key:       OTlmMmMxYjgtZjEzMS00MTkwLWI1NDQtYjI2MTc1MTk1ZTkz=
  
  </code></pre>
  <p>Now I want to convert this text file into json file using <strong>powerShell.</strong></p>
  <p>1&gt; If we convert this directly using -ConvertToJson then it gives unwanted o/p.</p>
  <p>2&gt; If we convert text file into op1.csv and then again convert to op2.json it also gives unwanted o/p(output).</p>
  <p>3&gt; If we remove extra \tabs and Whitespaces from the file and then repeating the step 2 gives trash.</p>
  <p>I want that o/p should be as follow.</p>
  <pre><code>[
    {
      &quot;ApplicationName&quot; : &quot;POADFJBKJBHACBNASCVX&quot;,
      &quot;SecretKey&quot;       : &quot;NDRkNDJjOTADFHACVJNmZTQy&quot;
    },
    {
      &quot;ApplicationName&quot; : &quot;NBFSVJBHACBNASCVX&quot;,
      &quot;SecretKey&quot;       : &quot;NDRkNDJjOTADFHACVJNmZTQy&quot;
    },
    {
      &quot;ApplicationName&quot; : &quot;VDFACBHACBNASCVX&quot;,
      &quot;SecretKey&quot;       : &quot;NDRkNDJjOTADFHACVJNmZTQy&quot;
    },
    {
      &quot;ApplicationName&quot; : &quot;ADFCASBKJBHACBNASCVX&quot;,
      &quot;SecretKey&quot;       : &quot;NDRkNDJjOTADFHACVJNmZTQy&quot;
    },
    {
      &quot;ApplicationName&quot; : &quot;DFCKJBHACBNASCVX&quot;,
      &quot;SecretKey&quot;       : &quot;NDRkNDJjOTADFHACVJNmZTQy&quot;
    },
    {
      &quot;ApplicationName&quot; : &quot;FERDBKJBHACBNASCVX&quot;,
      &quot;SecretKey&quot;       : &quot;NDRkNDJjOTADFHACVJNmZTQy&quot;
    },
    ...
  ]
  </code></pre>
  <p><strong>Note: there may be N number of blocks in Text File.</strong></p>