-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Cannot parse json output due to duplicate keys #27698
Copy link
Copy link
Open
Labels
Auto-AssignAuto assign by botAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamThe command of the issue is owned by Azure CLI teamComputeaz vm/vmss/image/disk/snapshotaz vm/vmss/image/disk/snapshotact-observability-squadquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Milestone
Metadata
Metadata
Assignees
Labels
Auto-AssignAuto assign by botAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamThe command of the issue is owned by Azure CLI teamComputeaz vm/vmss/image/disk/snapshotaz vm/vmss/image/disk/snapshotact-observability-squadquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Describe the bug
Some commands return json values with duplicate keys when case-insensitive.
Here is an example:
az vm list-skus --location centralus --size "Standard_D4s_v5" --all -o json | ConvertFrom-JsonThis is also an issue with ConvertFrom-Json not being case-sensitive. However, is it possible to restrict the output of az cli to not include duplicate case-insensitive keys?
The other reason I point this out is because the name field is not really being used:
This lowercase 'name' being set to null seems to not be serving any purpose.
Related command
az vm list-skusErrors
ConvertFrom-Json : Cannot convert the JSON string because a dictionary that was converted from the string contains the
duplicated keys 'Name' and 'name'.
Issue script & Debug output
N/A
Expected behavior
Any command with
-o jsonbeing piped to ConvertFrom-Json should always successfully result in an object.Environment Summary
"azure-cli": "2.53.1",
"azure-cli-core": "2.53.1",
"azure-cli-telemetry": "1.1.0",
"extensions": {}
Additional context
No response