Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Tcl) Create a JSON Array Containing an ObjectCreates a top-level JSON array containing an object.
load ./chilkat.dll set jArray [new_CkJsonArray] CkJsonArray_AddObjectAt $jArray 0 # json is a CkJsonObject set json [CkJsonArray_ObjectAt $jArray 0] CkJsonObject_UpdateString $json "groupId" "" CkJsonObject_UpdateString $json "sku" "" CkJsonObject_UpdateString $json "title" "" CkJsonObject_UpdateString $json "barcode" "" CkJsonObject_UpdateString $json "category" "" CkJsonObject_UpdateString $json "description" "" CkJsonObject_UpdateString $json "images[0]" "url1" CkJsonObject_UpdateString $json "images[1]" "url..." CkJsonObject_UpdateString $json "isbn" "" CkJsonObject_UpdateString $json "link" "" CkJsonObject_UpdateString $json "linkLomadee" "" CkJsonObject_UpdateString $json "prices[0].type" "" CkJsonObject_UpdateNumber $json "prices[0].price" "0" CkJsonObject_UpdateNumber $json "prices[0].priceLomadee" "0" CkJsonObject_UpdateNumber $json "prices[0].priceCpa" "0" CkJsonObject_UpdateNumber $json "prices[0].installment" "0" CkJsonObject_UpdateNumber $json "prices[0].installmentValue" "0" CkJsonObject_UpdateString $json "productAttributes.\"Atributo 1\"" "Valor 1" CkJsonObject_UpdateString $json "productAttributes.\"Atributo ...\"" "Valor ..." CkJsonObject_UpdateString $json "technicalSpecification.\"Especificação 1\"" "Valor" CkJsonObject_UpdateString $json "technicalSpecification.\"Especificação ...\"" "Valor ..." CkJsonObject_UpdateNumber $json "quantity" "0" CkJsonObject_UpdateNumber $json "sizeHeight" "0" CkJsonObject_UpdateNumber $json "sizeLength" "0" CkJsonObject_UpdateNumber $json "sizeWidth" "0" CkJsonObject_UpdateNumber $json "weightValue" "0" CkJsonObject_UpdateNumber $json "declaredPrice" "0" CkJsonObject_UpdateNumber $json "handlingTimeDays" "0" CkJsonObject_UpdateBool $json "marketplace" 0 CkJsonObject_UpdateString $json "marketplaceName" "" CkJsonArray_put_EmitCompact $jArray 0 puts [CkJsonArray_emit $jArray] # 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": "" # } # ] delete_CkJsonArray $jArray |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.