PowerShell
PowerShell
Example: JsonObject.NewArrayOf method
See more JSON Examples
Demonstrates theNewArrayOf method.
Chilkat PowerShell Downloads
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"
$success = $false
$big_cats = "[`"lion`",`"tiger`",`"leopard`",`"jaguar`",`"cheetah`",`"snow leopard`",`"clouded leopard`",`"cougar`",`"puma`",`"panther`"]"
$json = New-Object Chilkat.JsonObject
$json.UpdateString("test","abc")
$success = $json.NewArrayOf("big_cats",$big_cats)
if ($success -eq $false) {
$($json.LastErrorText)
exit
}
$json.EmitCompact = $false
$($json.Emit())
# Result:
# {
# "test": "abc",
# "big_cats": [
# "lion",
# "tiger",
# "leopard",
# "jaguar",
# "cheetah",
# "snow leopard",
# "clouded leopard",
# "cougar",
# "puma",
# "panther"
# ]
# }