Sample code for 30+ languages & platforms
PureBasic

Transition from Crypt2.LastJsonData to Crypt2.GetLastJsonData

Provides instructions for replacing deprecated LastJsonData method calls with GetLastJsonData.

Chilkat PureBasic Downloads

PureBasic
IncludeFile "CkCrypt2.pb"
IncludeFile "CkJsonObject.pb"

Procedure ChilkatExample()

    success.i = 0

    crypt2.i = CkCrypt2::ckCreate()
    If crypt2.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    ; ...
    ; ...

    ; ------------------------------------------------------------------------
    ; The LastJsonData method is deprecated:

    jsonObj.i = CkCrypt2::ckLastJsonData(crypt2)
    If CkCrypt2::ckLastMethodSuccess(crypt2) = 0
        Debug CkCrypt2::ckLastErrorText(crypt2)
        CkCrypt2::ckDispose(crypt2)
        ProcedureReturn
    EndIf

    ; ...
    ; ...

    CkJsonObject::ckDispose(jsonObj)

    ; ------------------------------------------------------------------------
    ; Do the equivalent using GetLastJsonData.
    ; Your application creates a new, empty JsonObject object which is passed 
    ; in the last argument and filled upon success.

    jsonOut.i = CkJsonObject::ckCreate()
    If jsonOut.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    CkCrypt2::ckGetLastJsonData(crypt2,jsonOut)
    If success = 0
        Debug CkCrypt2::ckLastErrorText(crypt2)
        CkCrypt2::ckDispose(crypt2)
        CkJsonObject::ckDispose(jsonOut)
        ProcedureReturn
    EndIf



    CkCrypt2::ckDispose(crypt2)
    CkJsonObject::ckDispose(jsonOut)


    ProcedureReturn
EndProcedure