Solved

Decode JSON-response to Excel

  • 2 March 2022
  • 2 replies
  • 25 views

Badge +6

I have a lot of JSON-responses that wraps an base64-encoded excelfile (response.json).

If I extract the data-part and try to decode it using BinaryDecoder (base64 to hex I guess). And then decode to ASCII, I get only a few chars that makes no sense.

 

If I use an online-service (https://www.base64decode.org/) and add the data-part of the JSON-file (JSON response -.....) I get a perfect excel-file.

 

I can't seem to figure out the part that the online-service performs and the part I can't make FME do.

 

Any help is appreciated.

 

icon

Best answer by nielsgerrits 2 March 2022, 12:19

View original

2 replies

Userlevel 6
Badge +33

I can get it to write a readable excel file using the following steps:

  • Use a BinaryDecoder to go from Base64 to Binary (fme-binary).
  • Use an AttributeFileWriter to write to a file, Target File Encoding = Binary (fme-binary).

Sample attached.

 

Badge +6

I can get it to write a readable excel file using the following steps:

  • Use a BinaryDecoder to go from Base64 to Binary (fme-binary).
  • Use an AttributeFileWriter to write to a file, Target File Encoding = Binary (fme-binary).

Sample attached.

 

Thank you. It works like a charm!

Reply