Skip to content

Invoke ConvertFrom-Json with -AsHashTable#216

Open
codethief wants to merge 1 commit intoAtlassianPS:masterfrom
codethief:fix/convertfrom-json-ashashtable
Open

Invoke ConvertFrom-Json with -AsHashTable#216
codethief wants to merge 1 commit intoAtlassianPS:masterfrom
codethief:fix/convertfrom-json-ashashtable

Conversation

@codethief
Copy link
Copy Markdown

@codethief codethief commented Mar 26, 2026

The Confluence REST API occasionally returns the field subtype as subType, see https://jira.atlassian.com/browse/CONFCLOUD-81438 .

This causes ConvertFrom-Json to produce the following error:

ConvertFrom-Json: Cannot convert the JSON string because it contains keys with different casing.
Please use the -AsHashTable switch instead. The key that was attempted to be
added to the existing key 'subType' was 'subtype'.

The parameter -AsHashTable causes keys to be treated case-sensitively, compare
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/convertfrom-json?view=powershell-7.6#-ashashtable .

The Confluence REST API occasionally returns the field `subtype` as `subType`,
see https://jira.atlassian.com/browse/CONFCLOUD-81438 .

This causes ConvertFrom-Json to produce the following error:

```
ConvertFrom-Json: Cannot convert the JSON string because it contains keys with different casing.
Please use the -AsHashTable switch instead. The key that was attempted to be
added to the existing key 'subType' was 'subtype'.
```

The parameter `-AsHashTable` causes keys to be treated case-sensitively,
compare
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/convertfrom-json?view=powershell-7.6#-ashashtable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant