JSON Example in PowerShell

PHOTO EMBED

Fri Jan 13 2023 01:55:39 GMT+0000 (Coordinated Universal Time)

Saved by @savabeh191

Copy code
# Define an object
$object = @{
    "name" = "John Doe"
    "age" = 35
    "address" = @{
        "street" = "123 Main St"
        "city" = "Anytown"
        "state" = "XX"
        "zip" = "12345"
    }
}

# Convert the object to a JSON string
$json = $object | ConvertTo-Json

# Output the JSON string
$json
content_copyCOPY

https://chat.openai.com/chat/829c91a7-896c-4e28-84e3-475514cda146