-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
az rest fails to parse json whitespace #10562
Comments
@jurgyy Thanks a lot for your feedback. I am out of office now and I will have a look when come back. |
Any updates? In the meanwhile, some debug information: With the following body
Notice the strange comma separation of the json in the command arguments and the number of Edit: I've traced the problem back to Knack and opened an issue there: microsoft/knack#165 |
If anyone encounters this issue before it is fixed I've found that writing the json to a temporary file and reference that works fine: $dict | ConvertTo-Json -Depth 100 > "./tmp/body.json"
az rest -m put --headers "Content-Type=application/json" -u $uri -b "@tmp/body.json" |
@jurgyy Hi, this problem is also related to the parsing of
You can have a try. If you still have any questions, please feel free to let us know~ |
@jurgyy any feedback ? |
I haven't tested it myself yet, but if it works this workaround is fine I guess. Not much you can do about Powershell's special characters anyway. Thanks! The issue can be closed, I think. |
@jurgyy OK, I'll close it first. If you still have any other questions, please feel free to let us know~ |
Describe the bug
Using powershell, az rest fails to parse my json correctly. I already read issue #9742 where @konrad-jamrozik had troubles parsing json correctly and he ended up having to escape the quotes (with
\"
not`"
, the .ps1 escape character). So I tried that, but it didn't solve all my problems. After some fiddling I found the problem: It was the whitespace in a string.To Reproduce
The following code fails:
Error:
While if we remove the whitespace from both the description and display name it will succeed:
Expected behavior
When using the portal whitespace is allowed, so I expect the json to parse correctly when using whitespace.
Environment summary
Install Method: MSI
CLI version: 2.0.73
OS: Windows 10
Shell Type: Powershell
The text was updated successfully, but these errors were encountered: