Sample code for 30+ languages & platforms
Visual Basic 6.0

Extract PDF from JSON

See more JSON Examples

Demonstrates 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.

Chilkat Visual Basic 6.0 Downloads

Visual Basic 6.0
Dim success As Long
success = 0

Dim json As New ChilkatJsonObject

' Load the JSON.
success = json.LoadFile("qa_data/json/JSR5U.json")
If (success <> 1) Then
    Debug.Print json.LastErrorText
    Exit Sub
End If

' The JSON we loaded contains this:

' 	{
' 	...
' 	...
' 	  "data": {
' 	    "content": "JVBERi0xLjQ..."
' 	  }
' 	...
' 	...
' 	}

Dim sb As New ChilkatStringBuilder
success = json.StringOfSb("data.content",sb)

Dim bd As New ChilkatBinData
success = bd.AppendEncodedSb(sb,"base64")

success = bd.WriteFile("qa_output/a0015.pdf")