| (Tcl) Extract PDF from JSONDemonstrates how to extract a PDF file contained within JSON.  The file is represented as a base64 string within the JSON.   Note: This example can extract any type of file, not just a PDF file. 
 
load ./chilkat.dll
set json [new_CkJsonObject]
# Load the JSON.
set success [CkJsonObject_LoadFile $json "qa_data/json/JSR5U.json"]
if {$success != 1} then {
    puts [CkJsonObject_lastErrorText $json]
    delete_CkJsonObject $json
    exit
}
# The JSON we loaded contains this:
# 	{
# 	...
# 	...
# 	  "data": {
# 	    "content": "JVBERi0xLjQ..."
# 	  }
# 	...
# 	...
# 	}
set sb [new_CkStringBuilder]
CkJsonObject_StringOfSb $json "data.content" $sb
set bd [new_CkBinData]
CkBinData_AppendEncodedSb $bd $sb "base64"
set success [CkBinData_WriteFile $bd "qa_output/a0015.pdf"]
delete_CkJsonObject $json
delete_CkStringBuilder $sb
delete_CkBinData $bd
 |