HTTP Rest API Base64 File Encode/Decode


I have the following JSON Rest API:

"file": {
        "filename": "string",
        "base64_content": "string",
        "file_type": "doc"

I’m trying desperately to convert the file via Base64 so that I can save the file from the HTTP request via JSON, but unfortunately it works. what am I doing wrong here?

Deserialize Json
Json Object: jsonoutput

base64str = jsonoutput(“data”).Item(0)(“file”)(“filename”).ToString

bytearray = Convert.FromBase64String(base64str)

Invoke Method

When testing the second assign, the following error message appears:

I have the suspicion that I somehow get the “file” wrong via JSON or am I completely wrong here?

Have you tested to change "filename" to "base64_content" instead?

base64str = jsonoutput("data").Item(0)("file")("base64_content").ToString

can you check or share with us the beginning of the base64 string? In some cases ther starter sequnence can let fail it

its running but has “null” content


base64str: “1234567.pdf” (The name of the file)

Could you show us the whole response json string? You should assign base64str to a value in the json response string that looks like gibberish, e.g.


as above shown error message was about an invalid Base64 String, we assumed that maybe some starter chars will cause it and asked therefore for the beggining part of the base64 string.

Unfortnately we do see the filename. But in the other screenshot we do see the typical Base64 content string. Can you please share with us the string begin? Thanks

The full content of the JSONOutput is (jsonoutput.ToString):

  "data": [
      "is_confirmed": false,
      "created_at": "2022-05-30",
      "has_cv_upload": true,
      "file": {
        "filename": "1234567.pdf",
        "base64_content": null,
        "file_type": "pdf"
  "links": {
    "self": null,
    "first": null,
    "prev": null,
    "next": null,
    "last": null

@ptrobot Unfortunately, I do not get this content output. That was my goal :). I always only get the filename as a string

@ppr this was the content from: jsonoutput(“data”).Item(0)(“file”)(“base64_content”).ToString > null

Then you need to check your API request. Maybe there’s a parameter you can add to request the content also (and not just the file name). “base64_content” should contain data and not null.