Extract active users from JSON with PowerShell
Build a paste-ready command, then review its compatibility and effects before running it.
Get-Content <file> -Raw | ConvertFrom-Json | Where-Object Active | Select-Object Name,Email | Format-Table -AutoSizeComplete required fields to copy the generated command.
read-onlyno known side effects Compatibility
WindowsVerified for Windows using powershell syntax.
Operational knowledgereview due 2027-01-19
RequirementsGet-ContentGet-Content must be installed and available on PATH.
Version supportGet-Content Current supported releasesVerified for windows using powershell syntax; consult compatibility notes for platform-specific differences.
Expected signalsName EmailRepresentative successful output; values vary with the selected target and system state.
Known errorsGet-Content: command not foundGet-Content is missing or is not available on PATH.
VerifyGet-Content {{file}} -Raw | ConvertFrom-Json | Where-Object Active | Select-Object Name,Email | Format-Table -AutoSizeThe output matches the expected target and exits without an error.Rollback noteNot required: this command is read-only and does not change system state.
Command breakdown
01Get-ContentCommandRuns the Get-Content stage of this one-liner.
02<file>ParameterA value supplied in the Fill parameters section.
03-RawOptionConfigures Get-Content with the -Raw option.
04|PipelinePasses the output on the left to the command on the right.
05ConvertFrom-JsonCommandRuns the ConvertFrom-Json stage of this one-liner.
06|PipelinePasses the output on the left to the command on the right.
07Where-ObjectCommandRuns the Where-Object stage of this one-liner.
08ActiveArgumentPasses Active to Where-Object.
09|PipelinePasses the output on the left to the command on the right.
10Select-ObjectCommandRuns the Select-Object stage of this one-liner.
11Name,EmailArgumentPasses Name,Email to Select-Object.
12|PipelinePasses the output on the left to the command on the right.
13Format-TableCommandRuns the Format-Table stage of this one-liner.
14-AutoSizeOptionConfigures Format-Table with the -AutoSize option.
This advanced community-curated one-liner combines several stages. Review every option and placeholder before running it.
Example input
Get-Content .\users.json -Raw | ConvertFrom-Json | Where-Object Active | Select-Object Name,Email | Format-Table -AutoSize
Example output
Name Email
---- -----
Ada Lovelace ada@example.com
Grace Hopper grace@example.com
Illustrative output — exact values vary by system and data.
Official sources