Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Yes, it is possible to transform a string object into a real object in PowerShell by using the ConvertFrom-Json cmdlet. This cmdlet converts a JSON-formatted string into a custom object in PowerShell. Here is an example:

$jsonString = '{"name":"John Smith","age":30,"city":"New York"}'
$realObject = ConvertFrom-Json $jsonString

In this example, the $jsonString variable contains a JSON-formatted string representing a person's name, age, and city. The ConvertFrom-Json cmdlet is used to convert this string into a custom object with properties for name, age, and city. The resulting object is stored in the $realObject variable.