I´m pretty new working with PowerShell and I have some doubts about some behavior related with PowerShell. Basically, I´m trying to create a .json file with the output of a select statement, for this I created a process that generates the .json file in SQL Server and then it prints it and lot it into a file using PowerShell
Invoke-Sqlcmd -inputfile $script -QueryTimeout 30 -ServerInstance $instance -Database $database -Verbose 4> "$file"
This process create a .json with the structure that I desired, but I saw some problems related with some strings that has a huge length were in this cases PowerShell added a line break when the string is too long. For example:
This file shows in the column4 where the string is getting cut like
Where the lines with Q and B are having a line break.
Is there a way to avoid PowerShell adding this extra line while the file creation process?
Or is any other way I can remove this line break without removing all the break lines?
I will appreciate any help provided.