Try without the pipeline:
PS C:\> ConvertTo-Json @('one', 'two')
[
"one",
"two"
]
PS C:\> ConvertTo-Json @('one')
[
"one"
]
More Related Contents:
- Get-Aduser -Filter will not accept a variable
- Delete files older than 15 days using PowerShell
- How to load assemblies in PowerShell?
- try, catch doesent seem to work
- How to get Powershell Invoke-Restmethod to return body of http 500 code response
- Powershell ConvertTo-json with embedded hashtable
- How Does Member Enumeration Work in PowerShell 3?
- Powershell script to see currently logged in users (domain and machine) + status (active, idle, away)
- Powershell Using Start-Process in PSSession to Open Notepad
- Powershell – Reboot and Continue Script
- Get-Content -wait not working as described in the documentation
- Check if a file exists or not in Windows PowerShell?
- PowerShell is missing the terminator: “
- Using PowerShell to remove lines from a text file if it contains a string
- Difference between PowerShell Console and PowerShell ISE
- Powershell: Set a Scheduled Task to run when user isn’t logged in
- List of all colors available for PowerShell?
- Need to extract value of attribute from xml from Command promt [closed]
- Convert a secure string to plain text
- How to exit from ForEach-Object in PowerShell
- Convert a string to datetime in PowerShell
- What does $_ mean in PowerShell?
- How to pass credentials to the Send-MailMessage command for sending emails
- How to normalize a path in PowerShell?
- How to create new clone instance of PSObject object
- How to create a shortcut using PowerShell
- Try/catch does not seem to have an effect
- PowerShell string interpolation syntax
- PowerShell launch script in new instance
- How to return specific data type from PowerShell function i.e. DataTable