Open
Description
Summary of the new feature
When you call get-content file.json | convertfrom-json
, funny things happen when file.json
contains a comment at the top of the file.
Multiple places suggest that it's better to use get-content -raw
for performance and predictability.
See:
- ConvertFrom-Json includes $null element on output if input starts with blank line PowerShell#12229
- https://stackoverflow.com/questions/71025659/set-property-value-on-object-loaded-from-json-containing-comments
Proposed technical implementation details (optional)
When get-content
is piped to convertfrom-*
, PSScriptAnalyzer should suggest adding -raw
to get-content
.
The same could apply to [xml] get-content file.xml
.
What is the latest version of PSScriptAnalyzer at the point of writing
1.21