Sample code for 30+ languages & platforms
AutoIt

Load a JSON Array

See more JSON Examples

The Chilkat JSON API requires the top-level JSON to be an object. Therefore, to load an array requires that it first be wrapped as an object.

Chilkat AutoIt Downloads

AutoIt
Local $bSuccess = False

; Imagine we want to load this JSON array for parsing:
Local $sJsonArrayStr = "[{""id"":200},{""id"":196}]"

; First wrap it in a JSON object by prepending "{ "array":" and appending "}"
$oSbJson = ObjCreate("Chilkat.StringBuilder")
$oSbJson.Append("{""array"":")
$oSbJson.Append($sJsonArrayStr)
$oSbJson.Append("}")

$oJson = ObjCreate("Chilkat.JsonObject")
$oJson.Load($oSbJson.GetAsString())

; Now we can get the JSON array
Local $oJArray = $oJson.ArrayAt(0)

; Do what you want with the JSON array...
; For example:
Local $oJObjId = $oJArray.ObjectAt(0)
ConsoleWrite($oJObjId.IntOf("id") & @CRLF)