Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3/4TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

DataFlex Examples

ASN.1
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Service Bus
Base64
Bounced Email
Box
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
ECC
Email Object
Encryption
FTP
Facebook
FileAccess
Firebase
GMail REST API
GeoOp
Google APIs
Google Calendar
Google Cloud Storage
Google Drive
Google Sheets
Gzip
HTML-to-XML/Text
HTTP
HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)

Java KeyStore (JKS)
Jira
MHT / HTML Email
MIME
Microsoft Graph
NTLM
OAuth1
OAuth2
OneDrive
OpenSSL
Outlook
PEM
PFX/P12
POP3
PRNG
PayPal
Peoplevox
QuickBooks
REST
REST Misc
RSA Encryption
SCP
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
SharePoint
Shopify
Socket/SSL/TLS
Spider
Stream
Stripe
SugarCRM
Tar Archive
Twitter
Upload
VoiceBase
Walmart
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Xero
Zip
curl
eBay

 

 

 

(DataFlex) Load a JsonArray

Demonstrates how to load a JsonArray.

Note: This example requires Chilkat v9.5.0.64 or greater.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoA
    Handle hoJson
    Variant vAbc
    Handle hoAbc
    String sTemp1

    //  This example requires Chilkat v9.5.0.64 or greater.

    //  Loading into a new JSON array is simple and straightforward.
    Get Create (RefClass(cComChilkatJsonArray)) To hoA
    If (Not(IsComObjectCreated(hoA))) Begin
        Send CreateComObject of hoA
    End
    Get ComLoad Of a "[ 1,2,3,4 ]" To iSuccess

    //  Output:  [1,2,3,4]
    Get ComEmit Of a To sTemp1
    Showln sTemp1
    Showln "--------"

    //  The JsonArray's Load and LoadSb methods have a peculiar behavior when
    //  it is already part of a JSON document.  In this case, the JsonArray
    //  becomes detached, and the original document remains unchanged.
    //  This is intentional due to the nature of the internal implementation.
    //  For example:

    Get Create (RefClass(cComChilkatJsonObject)) To hoJson
    If (Not(IsComObjectCreated(hoJson))) Begin
        Send CreateComObject of hoJson
    End
    Get ComLoad Of hoJson '{ "abc": [ 1,2,3,4 ] }' To iSuccess

    //  Output:  (json) {"abc":[1,2,3,4]}
    Get ComEmit Of hoJson To sTemp1
    Showln "(json) " sTemp1
    Showln "--------"

    Get ComArrayOf Of hoJson "abc" To vAbc
    If (IsComObject(vAbc)) Begin
        Get Create (RefClass(cComChilkatJsonArray)) To hoAbc
        Set pvComObject Of hoAbc To vAbc
    End
    //  When Load is called, abc becomes it's own document, and the original is not modified.
    Get ComLoad Of hoAbc "[ 5,6,7,8 ]" To iSuccess

    //  Output: (abc) [5,6,7,8]
    Get ComEmit Of hoAbc To sTemp1
    Showln "(abc) " sTemp1
    Showln "--------"

    //  Output: (json) {"abc":[1,2,3,4]}
    Get ComEmit Of hoJson To sTemp1
    Showln "(json) " sTemp1
    Showln "--------"
    Send Destroy of hoAbc


End_Procedure

 

© 2000-2019 Chilkat Software, Inc. All Rights Reserved.