Sample code for 30+ languages & platforms
AutoIt

Create a JSON Array Containing an Object

See more JSON Examples

Creates a top-level JSON array containing an object.

Chilkat AutoIt Downloads

AutoIt
$oJArray = ObjCreate("Chilkat.JsonArray")

$oJson = ObjCreate("Chilkat.JsonObject")
$oJArray.AddObjectAt2(0,$oJson)

$oJson.UpdateString("groupId","")
$oJson.UpdateString("sku","")
$oJson.UpdateString("title","")
$oJson.UpdateString("barcode","")
$oJson.UpdateString("category","")
$oJson.UpdateString("description","")
$oJson.UpdateString("images[0]","url1")
$oJson.UpdateString("images[1]","url...")
$oJson.UpdateString("isbn","")
$oJson.UpdateString("link","")
$oJson.UpdateString("linkLomadee","")
$oJson.UpdateString("prices[0].type","")
$oJson.UpdateNumber("prices[0].price","0")
$oJson.UpdateNumber("prices[0].priceLomadee","0")
$oJson.UpdateNumber("prices[0].priceCpa","0")
$oJson.UpdateNumber("prices[0].installment","0")
$oJson.UpdateNumber("prices[0].installmentValue","0")
$oJson.UpdateString("productAttributes.""Atributo 1""","Valor 1")
$oJson.UpdateString("productAttributes.""Atributo ...""","Valor ...")
$oJson.UpdateString("technicalSpecification.""Especificação 1""","Valor")
$oJson.UpdateString("technicalSpecification.""Especificação ...""","Valor ...")
$oJson.UpdateNumber("quantity","0")
$oJson.UpdateNumber("sizeHeight","0")
$oJson.UpdateNumber("sizeLength","0")
$oJson.UpdateNumber("sizeWidth","0")
$oJson.UpdateNumber("weightValue","0")
$oJson.UpdateNumber("declaredPrice","0")
$oJson.UpdateNumber("handlingTimeDays","0")
$oJson.UpdateBool("marketplace",False)
$oJson.UpdateString("marketplaceName","")

$oJArray.EmitCompact = False
ConsoleWrite($oJArray.Emit() & @CRLF)

; The output of this program is:

; [
;   {
;     "groupId": "",
;     "sku": "",
;     "title": "",
;     "barcode": "",
;     "category": "",
;     "description": "",
;     "images": [
;       "url1",
;       "url..."
;     ],
;     "isbn": "",
;     "link": "",
;     "linkLomadee": "",
;     "prices": [
;       {
;         "type": "",
;         "price": 0,
;         "priceLomadee": 0,
;         "priceCpa": 0,
;         "installment": 0,
;         "installmentValue": 0
;       }
;     ],
;     "productAttributes": {
;       "Atributo 1": "Valor 1",
;       "Atributo ...": "Valor ..."
;     },
;     "technicalSpecification": {
;       "Especificação 1": "Valor",
;       "Especificação ...": "Valor ..."
;     },
;     "quantity": 0,
;     "sizeHeight": 0,
;     "sizeLength": 0,
;     "sizeWidth": 0,
;     "weightValue": 0,
;     "declaredPrice": 0,
;     "handlingTimeDays": 0,
;     "marketplace": false,
;     "marketplaceName": ""
;   }
; ]