Closed yotsuda closed 1 week ago
The output from Import-CSV has every field as a string field. For example "$True" is just a string, not a boolean.
Look at output with
PS> Import-Csv input.csv | ConvertTo-JSON
[
{
"Label": "$false",
"BoolValue": "$false",
"NullableBoolValue": "$false",
"SwitchParamValue": "$false"
},
{
"Label": "$true",
"BoolValue": "$true",
"NullableBoolValue": "$true",
"SwitchParamValue": "$true"
},
...etc...
If you want a data file that keeps its PowerShell types then look at Import-PowerShellDataFile
@rhubarb-geek-nz Thank you for your prompt response. I apologize for the incorrect report. I will refer to the information you provided. Thanks.
@yotsuda are you happy for this to closed and labeled as resolution-answered?
@kilasuit Yes, I'm happy for this to be closed and labeled as resolution-answered. Thank you for your assistance!
📣 Hey @yotsuda, how did we do? We would love to hear your feedback with the link below! 🗣️
🔗 https://aka.ms/PSRepoFeedback
Prerequisites
Steps to reproduce
In cmdlet implementation with c#, following code doesn't work as expected.
Sample input.csv:
Run it as follows:
PS> Import-Csv input.csv | New-MyItem
Expected behavior
Actual behavior
Error details
No response
Environment data
Visuals
No response