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
(PureBasic) Create a JSON Array Containing an ObjectCreates a top-level JSON array containing an object.
IncludeFile "CkJsonArray.pb" IncludeFile "CkJsonObject.pb" Procedure ChilkatExample() jArray.i = CkJsonArray::ckCreate() If jArray.i = 0 Debug "Failed to create object." ProcedureReturn EndIf CkJsonArray::ckAddObjectAt(jArray,0) json.i = CkJsonArray::ckObjectAt(jArray,0) CkJsonObject::ckUpdateString(json,"groupId","") CkJsonObject::ckUpdateString(json,"sku","") CkJsonObject::ckUpdateString(json,"title","") CkJsonObject::ckUpdateString(json,"barcode","") CkJsonObject::ckUpdateString(json,"category","") CkJsonObject::ckUpdateString(json,"description","") CkJsonObject::ckUpdateString(json,"images[0]","url1") CkJsonObject::ckUpdateString(json,"images[1]","url...") CkJsonObject::ckUpdateString(json,"isbn","") CkJsonObject::ckUpdateString(json,"link","") CkJsonObject::ckUpdateString(json,"linkLomadee","") CkJsonObject::ckUpdateString(json,"prices[0].type","") CkJsonObject::ckUpdateNumber(json,"prices[0].price","0") CkJsonObject::ckUpdateNumber(json,"prices[0].priceLomadee","0") CkJsonObject::ckUpdateNumber(json,"prices[0].priceCpa","0") CkJsonObject::ckUpdateNumber(json,"prices[0].installment","0") CkJsonObject::ckUpdateNumber(json,"prices[0].installmentValue","0") CkJsonObject::ckUpdateString(json,"productAttributes." + Chr(34) + "Atributo 1" + Chr(34),"Valor 1") CkJsonObject::ckUpdateString(json,"productAttributes." + Chr(34) + "Atributo ..." + Chr(34),"Valor ...") CkJsonObject::ckUpdateString(json,"technicalSpecification." + Chr(34) + "Especificação 1" + Chr(34),"Valor") CkJsonObject::ckUpdateString(json,"technicalSpecification." + Chr(34) + "Especificação ..." + Chr(34),"Valor ...") CkJsonObject::ckUpdateNumber(json,"quantity","0") CkJsonObject::ckUpdateNumber(json,"sizeHeight","0") CkJsonObject::ckUpdateNumber(json,"sizeLength","0") CkJsonObject::ckUpdateNumber(json,"sizeWidth","0") CkJsonObject::ckUpdateNumber(json,"weightValue","0") CkJsonObject::ckUpdateNumber(json,"declaredPrice","0") CkJsonObject::ckUpdateNumber(json,"handlingTimeDays","0") CkJsonObject::ckUpdateBool(json,"marketplace",0) CkJsonObject::ckUpdateString(json,"marketplaceName","") CkJsonArray::setCkEmitCompact(jArray, 0) Debug CkJsonArray::ckEmit(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": "" ; } ; ] CkJsonArray::ckDispose(jArray) ProcedureReturn EndProcedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.