With the introduction of the HTTP connector, App Connect users have the ability to call out from their flows to any HTTP endpoint. You can find details of this here.

But what can you do with the data you get back from this endpoint?

Nowadays, many HTTP endpoints will return data in JSON format. JSON stands for JavaScript Object Notation, and is a data format which structures data in a way that is easy for both humans and machines to understand. The new JSON Parser node allows users to consume data from a JSON response and use it in their App Connect flows (event-driven and API).

Take for example this event-driven App Connect flow, which triggers an HTTP call to an API provided by The Weather Company. The HTTP response contains a large amount of weather information, encoded in JSON format. However, not all of this information is relevant to the action we want from this flow, which is to send an email to some interested parties giving them a brief summary of the weather in their area.

Setting up HTTP call

This is where the JSON Parser node comes into play

To use the JSON Parser node, we select it from the Logic tab.

Selecting JSON Parser

There are three fields on the node:

  • JSON Input
  • Example JSON
  • JSON Schema

In the JSON Input field, we map the response from the HTTP connector, which will be the JSON data we wish to parse. (It is also possible to populate this field with raw JSON data but this is unnecessary for this example). In the Example JSON field we simply paste an example of the JSON data we expect to get back from our HTTP endpoint. Then, by clicking the Generate Schema button, the JSON Schema field is automatically populated with the correct JSON schema, which will be used to map the fields from our JSON Input downstream in our flow. (Alternatively, if we had the schema to hand then we could paste it directly into the JSON Schema field.)

Using JSON Parser

Finally, we add a Gmail connector to send an email to our interested parties, giving them a summary of the weather forecast for their region. The Gmail connector has access to all of the properties from our parsed JSON response.

Gmail message with inputs from JSON Parser

And voila! The flow results in an email populated with a short forecast taken from data from The Weather Company API, made possible by the new JSON Parser node.

Join The Discussion

Your email address will not be published. Required fields are marked *