Nested Json objects output as escaped strings
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
### **This is autogenerated. Please review and update as needed.**
## Describe the bug
Json output that has nested objects are being treated as strings and escaped instead of properly serialized
**Command Name**
`az appconfig kv show`
**Errors:**
No errors
## To Reproduce:
Run this in PowerShell 7.3.2
```
$escapedNestedJson = @"
{
"contentType": "application/vnd.microsoft.appconfig.keyvaultref+json;charset=utf-8",
"etag": "A9U7H9eKbG0PLrqIbV9VeXVcWxb",
"key": "Test:Test",
"label": "MyLabel",
"lastModified": "2021-12-01T22:54:28+00:00",
"locked": false,
"tags": {},
"value": "{\"uri\":\"https://mykeyvault.vault.azure.net/secrets/test\"}"
}
"@
$notConvenientObject = ConvertFrom-Json $escapedNestedJson
Write-Host "Uri Doesn't Work: $($notConvenientObject.value.uri)"
Write-Host "I don't want to do this: $($($notConvenientObject.value | ConvertFrom-Json).Uri)"
$fixedNestedJson = @"
{
"contentType": "application/vnd.microsoft.appconfig.keyvaultref+json;charset=utf-8",
"etag": "A9U7H9eKbG0PLrqIbV9VeXVcWxb",
"key": "Test:Test",
"label": "MyLabel",
"lastModified": "2021-12-01T22:54:28+00:00",
"locked": false,
"tags": {},
"value": {"uri":"https://mykeyvault.vault.azure.net/secrets/test"}
}
"@
$convenientObject = ConvertFrom-Json $fixedNestedJson
Write-Host "Uri Works: $($convenientObject.value.uri)"
```
## Expected Behavior
Nested Json objects are correctly serialized / deserialized instead of being considered a string
## Environment Summary
```
Windows-10-10.0.19044-SP0
Python 3.10.8
Installer: MSI
azure-cli 2.45.0
Extensions:
aks-preview 0.5.98
image-copy-extension 0.2.11
Dependencies:
msal 1.20.0
azure-mgmt-resource 21.1.0b1
```
## Additional Context
Contributor guide
Assessment
This issue has not been assessed yet.