February 2019
Intermediate to advanced
626 pages
15h 51m
English
The ConvertFrom-Json command is used to turn a JSON document into an object, for example:
'{ "Property": "Value" }' | ConvertFrom-Json
ConvertFrom-Json creates a PSCustomObject.
JSON understands a number of different data types, and each of these types is converted into an equivalent .NET type. The following example shows how each different type might be represented:
$object = @"{
"Decimal": 1.23,
"String": "string",
"Int32": 1,
"Int64": 2147483648,
"Boolean": true
}
"@ | ConvertFrom-Json
Inspecting individual elements after conversion reflects the type, as demonstrated in the following example:
PS> $object.Int64.GetType() PS> $object.Boolean.GetType() IsPublic IsSerial Name BaseType -------- -------- ---- -------- True ...
Read now
Unlock full access