Các bit mã sau đây tạo ra một lỗiConvertTo-Json ném lỗi khi sử dụng một chuỗi chấm dứt trong xuyệc ngược
W:\surge\ogre> @{SolutionDir='W:\Surge\ogre\'} | ConvertTo-Json
ConvertTo-Json : The converted JSON string is in bad format.
At line:1 char:35
+ @{SolutionDir='W:\Surge\ogre\'} | ConvertTo-Json
+ ~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Collections.Hashtable:PSObject) [ConvertTo-Json], InvalidOperationException
+ FullyQualifiedErrorId : JsonStringInBadFormat,Microsoft.PowerShell.Commands.ConvertToJsonCommand
Tại sao? Làm thế nào tôi có thể sửa lỗi này? Đây là một sự kiện prebuild vì vậy tôi đang cố gắng giữ cho nó một dòng và gọn nhẹ nhất có thể.
Thành thật mà nói: nó trông giống như một lỗi trong xử lý dấu vết '\'. Nó hoạt động tốt nếu bạn ConvertFrom-Json dữ liệu thích hợp, nhưng không phải cách khác xung quanh. – BartekB