Last active
August 10, 2023 13:48
-
-
Save knbknb/6ee8c2bab9800e48b73c15c98eb70723 to your computer and use it in GitHub Desktop.
json | powershell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# display a JSON object as a table using PowerShell. | |
# the JSON is generated by a perl script | |
perl api-gfz.pl -r \ | |
| pwsh -Command "$json = Get-Content -Raw -Stream; ConvertFrom-Json $json | Format-Table -AutoSize " | |
# with a Where-Object filter in between: | |
perl api-gfz.pl -r \ | |
| pwsh -Command "$json = Get-Content -Raw -Stream; ConvertFrom-Json $json | Where-Object { \$_.status -eq 'paused' } | Format-Table -AutoSize " | |
# Assumes that the JSON structure is an array of objects |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment