Lazy Diary @ Hatena Blog

PowerShell / Java / miscellaneous things about software development, Tips & Gochas. CC BY-SA 4.0/Apache License 2.0

If you pass an empty string to ConvertFrom-Json

According to the spec of JSON, an empty string is not a valid JSON.

  • If you pass an empty string to ConvertFrom-Json, it returns $null (doesn’t raise an exception).
  • If you pass an empty JSON (“[]”) to ConvertFrom-Json, it returns empty list (@()).