I have a query defined as follows:
$Query = "Select field1, field2, field3 from table
field3
is a comma-separated field: valueA,valueB,valueC
I'm using powershell's ConvertTo-Json method to return the results in a Json object. So my results looks like this:
{
"field1" : "value1",
"field2" : "value2",
"field3" : "valueA,valueB,valueC"
}
What I'm trying to accomplish is for field3 values to get stored in an array object so my desire results would like this:
{
"field1" : "value1",
"field2" : "value2",
"field3" : [
"valueA",
"valueB",
"valueC"
]
}
Is this possible to accomplish using powershell?