Skip to main content
Solved

Decode JSON-response to Excel

  • March 2, 2022
  • 2 replies
  • 166 views

mathiku
Supporter
Forum|alt.badge.img+8

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.

 

Best answer by nielsgerrits

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.

 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

nielsgerrits
VIP
Forum|alt.badge.img+60
  • 2938 replies
  • Best Answer
  • March 2, 2022

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.

 


mathiku
Supporter
Forum|alt.badge.img+8
  • Author
  • Supporter
  • 69 replies
  • March 9, 2022

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!