![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java JavaScript Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PureBasic) Example: JsonObject.NewArrayOf methodSee more JSON ExamplesDemonstrates theNewArrayOf method.Note: This example requires Chilkat v11.4.0 or greater.
IncludeFile "CkJsonObject.pb" Procedure ChilkatExample() success.i = 0 big_cats.s = "[" + Chr(34) + "lion" + Chr(34) + "," + Chr(34) + "tiger" + Chr(34) + "," + Chr(34) + "leopard" + Chr(34) + "," + Chr(34) + "jaguar" + Chr(34) + "," + Chr(34) + "cheetah" + Chr(34) + "," + Chr(34) + "snow leopard" + Chr(34) + "," + Chr(34) + "clouded leopard" + Chr(34) + "," + Chr(34) + "cougar" + Chr(34) + "," + Chr(34) + "puma" + Chr(34) + "," + Chr(34) + "panther" + Chr(34) + "]" json.i = CkJsonObject::ckCreate() If json.i = 0 Debug "Failed to create object." ProcedureReturn EndIf CkJsonObject::ckUpdateString(json,"test","abc") success = CkJsonObject::ckNewArrayOf(json,"big_cats",big_cats) If success = 0 Debug CkJsonObject::ckLastErrorText(json) CkJsonObject::ckDispose(json) ProcedureReturn EndIf CkJsonObject::setCkEmitCompact(json, 0) Debug CkJsonObject::ckEmit(json) ; Result: ; { ; "test": "abc", ; "big_cats": [ ; "lion", ; "tiger", ; "leopard", ; "jaguar", ; "cheetah", ; "snow leopard", ; "clouded leopard", ; "cougar", ; "puma", ; "panther" ; ] ; } CkJsonObject::ckDispose(json) ProcedureReturn EndProcedure |
||||
© 2000-2026 Chilkat Software, Inc. All Rights Reserved.