Cloud JSON Parsing

@ruben, here is the webhook json file with the JSON filter you need to extract the data you specificed:

{
"event": "test1",
"url": "http://api.wunderground.com/api/yourkey/hourly/q/OH/Cincinnati.json",
"requestType": "POST",
"headers": null,
"query": null,
"responseTemplate": "{{#response}}{{#hourly_forecast}}{{FCTTIME.hour}}~{{qpf.english}}~{{pop}}~{{/hourly_forecast}}{{/response}}",
"json": null,
"auth": null,
"mydevices": true
}

The filer works this way:

  • the root object is response which leads to {{#response}} to “open” it
  • the object under the root where all your data is hourly_forecast which leads to {{#hourly_forecast}} to open it
  • the first item you want is hour under FCTTIME which leads to {{FCTTIME.hour}}
  • the ~ is included in the filtered string and acts as a separator
  • the second item you want is english under qpf which leads to {{qpf.english}}
  • another ~ separator
  • the final item you want is pop which leads to {{pop}}
  • a final ~ as separator
  • The {{/hourly_forecast}}{{/response}} are used to “close” the two open objects

You are left with 36 hours of data or one response “payload” sent by the cloud. Of this data, you keep only the first 28 bytes being the next 3 hours of data. You then parse that data with the ~ separating the hourly data sets. :smiley:

5 Likes