How to obtain the output of GET Request node in JSON fomat?

Hi guys,

I have a problem with the GET Request node.

In older KNIME versions I could correctly retrieve and read REST requests using a combination of 2 nodes: GET Resource and Read REST Representation nodes. In the current version of KNIME these 2 nodes are no longer available and (I guess) they are substituted with the GET Request node.

As you can see in the attached workflow my problem is that when I run the node, its output data type is BLOB instead of the expected JSON. According to the node description BLOB is the default data type in the case where no automatic data type conversion is possible.

How can I obtained the output of GET Request node in JSON format?

Thank you in advance for any help

Gio

3 Likes

Use Binary Object to String and then String to JSON. If web service correctly marks the response as application/json then it's automatically converted into JSON. This doesn't seem to be the case here. What Content-Type is the web service sending?

4 Likes

Hi Thor,

Thank you for your prompt reply. The web service is sending "text/javascript" as Content-Type.

I already tried using Binary Object to String node but as I wasn't seeing anything inspecting the table I was thinking it was not correctly working. Nevertheless if I use the String to JSON node after it, then I can see the content correctly translated.

Thank you again for point me to the solution!

Gio

1 Like

Hello, sorry for bumping an older post, but I came across the same issue.

I get a “Content-Type: application/vnd.api+json” as a reply and KNIME stores it as a blob. :expressionless:

As suggested in this thread: “Binary Object to String, String to JSON” gets me a JSON, so that’s fine, but I have to wonder, why is the GET node such a diva? Is there no way how force the response to a JSON format without the extra steps?

4 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.