|  | 
Chilkat  HOME  Android™  AutoIt  C  C#  C++  Chilkat2-Python  CkPython  Classic ASP  DataFlex  Delphi DLL  Go  Java  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
| (Swift) JSON Insert Empty Array or ObjectDemonstrates how to use the UpdateNewArray and UpdateNewObject methods to insert an empty array or object. Note: The UpdateNewArray an UpdateNewObject methods were introduced in Chilkat v9.5.0.75. 
 func chilkatTest() { let json = CkoJsonObject()! var success: Bool // The following code builds the following JSON, which contains both an empty array and empty object: // { // "abc": { // "xyz": [ // { // "Name": "myName", // "Description": "description", // "ScheduleDefinition": "schedule definition", // "ExceptionScheduleDefinition": "", // "Attribute": [ // ], // "SomeEmptyObject": {}, // "token": "token" // } // ] // } // } json.update("abc.xyz[0].Name", value: "myName") json.update("abc.xyz[0].Description", value: "description") json.update("abc.xyz[0].ScheduleDefinition", value: "schedule definition") json.update("abc.xyz[0].ExceptionScheduleDefinition", value: "") json.updateNewArray("abc.xyz[0].Attribute") json.updateNewObject("abc.xyz[0].SomeEmptyObject") json.update("abc.xyz[0].token", value: "token") json.emitCompact = false print("\(json.emit()!)") } | ||||
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.