DataFlex
DataFlex
Get JSON Details from the Last PFX Operation
See more PFX/P12 Examples
Demonstrates Pfx.GetLastJsonData, which replaces the contents of a JsonObject with structured JSON information from the most recent operation.
The file path is relative to the application's current working directory. An absolute path may also be used. Supply the path 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. The data is copied as a complete replacement and is never merged with existing members. The exact members depend on the operation that produced them.
Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoPfx
String sPassword
Variant vJson
Handle hoJson
String sJsonStr
String sTemp1
Move False To iSuccess
Get Create (RefClass(cComChilkatPfx)) To hoPfx
If (Not(IsComObjectCreated(hoPfx))) Begin
Send CreateComObject of hoPfx
End
// The file path is relative to the application's current working directory. An absolute path
// may also be used. Supply the path appropriate to your own environment.
// The PFX password should come from a secure source rather than being hard-coded.
Move "myPfxPassword" To sPassword
Get ComLoadPfxFile Of hoPfx "qa_data/identity.pfx" sPassword To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoPfx To sTemp1
Showln sTemp1
Procedure_Return
End
// Copy structured JSON information from the most recent operation into a JsonObject. The contents
// entirely replace anything already in the object.
Get Create (RefClass(cComChilkatJsonObject)) To hoJson
If (Not(IsComObjectCreated(hoJson))) Begin
Send CreateComObject of hoJson
End
Get pvComObject of hoJson to vJson
Send ComGetLastJsonData To hoPfx vJson
Set ComEmitCompact Of hoJson To False
Get ComEmit Of hoJson To sJsonStr
Showln sJsonStr
// JSON parsing code for this result can be generated at Chilkat's online tool:
// https://tools.chilkat.io/jsonParse
End_Procedure