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
(PowerBuilder) Create a JSON Array Containing an ObjectCreates a top-level JSON array containing an object.
integer li_rc oleobject loo_JArray oleobject loo_Json loo_JArray = create oleobject // Use "Chilkat_9_5_0.JsonArray" for versions of Chilkat < 10.0.0 li_rc = loo_JArray.ConnectToNewObject("Chilkat.JsonArray") if li_rc < 0 then destroy loo_JArray MessageBox("Error","Connecting to COM object failed") return end if loo_JArray.AddObjectAt(0) loo_Json = loo_JArray.ObjectAt(0) loo_Json.UpdateString("groupId","") loo_Json.UpdateString("sku","") loo_Json.UpdateString("title","") loo_Json.UpdateString("barcode","") loo_Json.UpdateString("category","") loo_Json.UpdateString("description","") loo_Json.UpdateString("images[0]","url1") loo_Json.UpdateString("images[1]","url...") loo_Json.UpdateString("isbn","") loo_Json.UpdateString("link","") loo_Json.UpdateString("linkLomadee","") loo_Json.UpdateString("prices[0].type","") loo_Json.UpdateNumber("prices[0].price","0") loo_Json.UpdateNumber("prices[0].priceLomadee","0") loo_Json.UpdateNumber("prices[0].priceCpa","0") loo_Json.UpdateNumber("prices[0].installment","0") loo_Json.UpdateNumber("prices[0].installmentValue","0") loo_Json.UpdateString("productAttributes.~"Atributo 1~"","Valor 1") loo_Json.UpdateString("productAttributes.~"Atributo ...~"","Valor ...") loo_Json.UpdateString("technicalSpecification.~"Especificação 1~"","Valor") loo_Json.UpdateString("technicalSpecification.~"Especificação ...~"","Valor ...") loo_Json.UpdateNumber("quantity","0") loo_Json.UpdateNumber("sizeHeight","0") loo_Json.UpdateNumber("sizeLength","0") loo_Json.UpdateNumber("sizeWidth","0") loo_Json.UpdateNumber("weightValue","0") loo_Json.UpdateNumber("declaredPrice","0") loo_Json.UpdateNumber("handlingTimeDays","0") loo_Json.UpdateBool("marketplace",0) loo_Json.UpdateString("marketplaceName","") loo_JArray.EmitCompact = 0 Write-Debug loo_JArray.Emit() // 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": "" // } // ] destroy loo_JArray |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.