Lazy Diary @ Hatena Blog

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

Entries from 2017-03-04 to 1 day

ConvertFrom-Json with empty JSON returns an empty list

Context: You want to receive an JSON and check whether the JSON is empty or not. Problem: You cannot check empty JSON with -eq operator, and -eq doesn’t return true/false. > $hoge = (Get-Content ./empty.json | ConvertFrom-Json) > $hoge -eq…