Get a parsed JSON Response

Problem

You want to return the JSON response of an HTTP request as a parsed Javascript object.

Solution

The HTTP Request node will return the body of a JSON response in the msg.payload as a string by default. Change the Return configuration of this node to a parsed JSON object to parse the JSON response in the msg.payload that can be easily accessed by downstream nodes.

Example

We have reconfigured the flow from the Set the URL of a Request URL recipe by changing the HTTP Request node configuration. The Debug node has been modified to display only the title property of the parsed JSON response:

"qui est esse"

Discussion

If your HTTP request returns XML, the XML node can be used to parse Javascript objects from XML documents.