title: Format a datetime in PowerShell to JSON as \/Date(1411704000000)\/
body: <p>I want to get the current date as a string in the following format:</p>
  
  <p><code>\/Date(1411762618805)\/</code></p>
  
  <p>I have been fighting with PowerShell and have tried the following, but it keeps wrapping the object with unwanted properties. I just need the <code>value</code></p>
  
  <pre><code>Get-Date | ConvertTo-Json
  # returns
  {
    "value":  "\/Date(1411762618805)\/",
    "DisplayHint":  2,
    "DateTime":  "Friday, September 26, 2014 4:16:58 PM"
  }
  </code></pre>
  
  <p>Of course if you try to convert back to an object with <code>ConvertFrom-Json</code> you are back with a .NET Date object.</p>
  
  <p>I have gotten closer with</p>
  
  <pre><code>Get-Date | Select-Object -Property Date | ConvertTo-Json
  {
    "Date":  "\/Date(1411704000000)\/"
  }
  </code></pre>
  
  <p>But it is still wrapped in a Date child property. At the end of the day all I want is a <strong>string</strong> with Microsoft's ugly JSON format.</p>
  
  <p>I only want to use the built in .NET JSON serializers if possible.</p>