Sample code for 30+ languages & platforms
Visual Basic 6.0

Get JSON Details from the Last Operation

See more MIME Examples

Demonstrates GetLastJsonData, which copies structured details from the most recent operation into a JsonObject when such details are available. Many operations produce no JSON data, in which case the object is empty or minimal.

The file paths are relative to the application's current working directory. Absolute paths may also be used. Supply the paths appropriate to your own environment.

Tip: Code to parse the returned JSON can be generated with Chilkat's online tool at https://tools.chilkat.io/jsonParse.

Background. Some Chilkat operations expose extra diagnostic or result information as JSON. GetLastJsonData provides access to that information after the operation completes.

Chilkat Visual Basic 6.0 Downloads

Visual Basic 6.0
Dim success As Long
success = 0

Dim mime As New ChilkatMime
success = mime.LoadMimeFile("qa_data/encrypted.eml")
If (success = 0) Then
    Debug.Print mime.LastErrorText
    Exit Sub
End If

'  Some operations produce structured JSON details.  After an operation, copy those details into a
'  JsonObject with GetLastJsonData.  Many methods produce no JSON, in which case the object is
'  little or empty.
Dim pfxPassword As String
pfxPassword = "myPfxPassword"
success = mime.AddPfxSourceFile("qa_data/recipient.pfx",pfxPassword)
If (success = 0) Then
    Debug.Print mime.LastErrorText
    Exit Sub
End If

success = mime.Decrypt()
If (success = 0) Then
    Debug.Print mime.LastErrorText
    Exit Sub
End If

Dim json As New ChilkatJsonObject
mime.GetLastJsonData json

json.EmitCompact = 0
Dim jsonStr As String
jsonStr = json.Emit()
Debug.Print jsonStr