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
(DataFlex) JSON AppendObject ExampleDemonstrates the AppendObject function.
Use ChilkatAx-win32.pkg Procedure Test Handle hoJson Boolean iSuccess Variant vJObj Handle hoJObj String sTemp1 Get Create (RefClass(cComChilkatJsonObject)) To hoJson If (Not(IsComObjectCreated(hoJson))) Begin Send CreateComObject of hoJson End Get ComLoad Of hoJson '{ "name": "John", "marbles": 100 }' To iSuccess // Append an empty object named "addr" Get ComAppendObject Of hoJson "addr" To vJObj If (IsComObject(vJObj)) Begin Get Create (RefClass(cComChilkatJsonObject)) To hoJObj Set pvComObject Of hoJObj To vJObj End Get ComEmit Of hoJson To sTemp1 Showln sTemp1 // Expected output is: {"name":"John","marbles":100,"addr":{}} // Add members to the object. Get ComAppendString Of hoJObj "street" "1200 Elm St." To iSuccess Get ComAppendString Of hoJObj "city" "Springfield" To iSuccess Get ComAppendInt Of hoJObj "zip" 60606 To iSuccess Get ComEmit Of hoJson To sTemp1 Showln sTemp1 // Expected output is: {"name":"John","marbles":100,"addr":{"street":"1200 Elm St.","city":"Springfield","zip":60606}} Send Destroy of hoJObj End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.