jsondecode.com logo

JSON to PowerShell Hashtable Converter — Free Online Tool

Convert JSON to PowerShell hashtable or PSCustomObject syntax using AI. Handles nested objects, arrays, nulls, and booleans with correct PowerShell syntax. Free, no sign-up.

JSON to BigQuery Schema Converter — Free Online ToolJSON to React Flow Diagram — Convert JSON Online FreeJSON to Go Struct with BSON Tags — Free Online ToolJSON to TypeScript Interface Generator — Free OnlineJSON to YAML Converter — Convert JSON to YAML OnlineJSON to CSV Converter — Export JSON Array to CSV FreeJSON to Python Dataclass Generator — Free Online ToolJSON to SQL INSERT Statement Generator — Free OnlineJSON to Markdown Table Converter — Free Online ToolJSON to XML Converter — Convert JSON to XML Online FreeJSON to HTML Table Converter — Free Online ToolYAML to JSON Converter — Convert YAML to JSON Online FreeXML to JSON Converter — Convert XML to JSON Online FreeJSON to JSON Schema Generator — Free Online ToolJSON to GraphQL Schema Generator — Free Online ToolRuby to JSON Converter — Convert Ruby Hashes to JSON OnlineJSON to C# Class Generator — Free Online ToolJSON to Java Class (POJO) Generator — Free Online ToolJSON to Kotlin Data Class Generator — Free Online ToolJSON to Rust Struct Generator — Free Online ToolJSON to PHP Array Converter — Free Online ToolCSV to JSON Converter — Free Online ToolJSON to Dart Class Generator — Free Online ToolJSON to Swift Struct (Codable) Generator — Free OnlineJSON to Terraform HCL Variables Converter — Free OnlineJSON to Mongoose Schema Generator — Free Online ToolJSON to Prisma Schema Model Generator — Free OnlineJSON to Protocol Buffer (proto3) Generator — Free OnlineJSON to TOML Config Format Converter — Free Online ToolTOML to JSON Converter — Convert TOML to JSON Online FreeJSON to Apache Avro Schema Generator — Free Online ToolJSON to OpenAPI 3.0 Schema Component — Free Online ToolJSON to R Data Frame Code Generator — Free Online ToolJSON to Lua Table Syntax Converter — Free Online ToolJSON to Zod Schema (TypeScript) Generator — Free OnlineJSON to Scala Case Class with Circe Codec — Free Online

JSON to PowerShell Hashtable Converter — Free Online Tool

About JSON to PowerShell Hashtable Converter — Free Online Tool

JSON to PowerShell converts a JSON object into PowerShell hashtable or PSCustomObject syntax, making it immediately usable in scripts, DSC configurations, and automation workflows. System administrators and developers use it to translate API responses or configuration payloads into native PowerShell data structures without manually rewriting bracket syntax.

JSON to PowerShell Type Mapping

JSON TypePowerShell TypeExample Output
stringString@{name = 'Alice'}
integerInt32 / Int64@{port = 8080}
floatDouble@{ratio = 3.14}
boolean trueBoolean ($true)@{enabled = $true}
boolean falseBoolean ($false)@{enabled = $false}
null$null@{value = $null}
objectNested @{}@{db = @{host = 'localhost'}}
array of stringsString[]@{tags = @('a','b')}
array of objectsArray of @{}@{items = @(@{id=1},@{id=2})}

PowerShell JSON Cmdlets Reference

CmdletPurposeKey Note
ConvertFrom-JsonJSON string → PSCustomObjectDot notation access: $obj.name
ConvertTo-JsonObject → JSON stringAlways use -Depth 10+ to avoid truncation
Invoke-RestMethodHTTP call → auto-parsed objectParses JSON automatically
Invoke-WebRequestHTTP call → raw responseUse .Content then ConvertFrom-Json
Get-Content | ConvertFrom-JsonRead JSON fileUse -Raw flag for single string
ConvertTo-Json | Set-ContentWrite JSON filePipe chain for file output

Frequently Asked Questions

How do I parse JSON in PowerShell?

Use ConvertFrom-Json: $obj = $jsonString | ConvertFrom-Json. The output is a PSCustomObject with properties matching JSON keys, accessible via dot notation ($obj.name). For JSON files: $obj = Get-Content 'file.json' -Raw | ConvertFrom-Json. The -Raw flag reads the file as a single string rather than an array of lines.

Why does ConvertTo-Json truncate my nested objects?

ConvertTo-Json has a default depth of 2, which truncates objects nested deeper than two levels. Always use -Depth 10 (or higher): $obj | ConvertTo-Json -Depth 10. This is the most common PowerShell JSON pitfall — missing -Depth causes silent data loss in the output.

What is the difference between a PowerShell hashtable and PSCustomObject?

A hashtable (@{key = 'value'}) is a dictionary accessed with brackets ($ht['key']). A PSCustomObject ([PSCustomObject]@{key = 'value'}) is a proper object with properties, supported by Format-Table and Select-Object. ConvertFrom-Json always returns PSCustomObject; both work with ConvertTo-Json but PSCustomObject serializes more reliably.

How do I convert a PowerShell hashtable to JSON?

Call ConvertTo-Json: @{name='Alice'; age=30} | ConvertTo-Json -Depth 5. For ordered keys, use [ordered]@{} instead of @{}, which outputs keys in insertion order. This is important when the JSON consumer expects a specific key ordering.

How do I call a REST API and work with JSON in PowerShell?

Use Invoke-RestMethod which automatically parses JSON responses: $result = Invoke-RestMethod -Uri 'https://api.example.com/data' -Method GET. For POST with JSON body: Invoke-RestMethod -Uri $url -Method POST -ContentType 'application/json' -Body ($body | ConvertTo-Json -Depth 10). Always convert the body to string first.

If jsondecode.com saved you time, share it with your team

Free forever. No ads. No sign-up. Help other developers find it.