<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Pulling multiple parameters from a single JSON result]]></title><description><![CDATA[<p dir="auto">Hey hey, I was wondering if doing something like the following would be possible.</p>
<p dir="auto">The DarkSky API allows me to get a JSON stream of, for example, the hourly temperatures from yesterday. I've figured out a regex which allows me to find each individual temperature as a group. What I'm wondering is is there a way I can pull each one of those temperature readings in so I can average them all once a day? I was thinking maybe into an alphanumeric point and them via scripting average them?</p>
<p dir="auto">I have a solution which I think would work, I can just pull weather data once an hour into a "current temperature" point and then average that at the end of the day, so no rush. I just think being able to do it using one query would be way cooler (although no one will appreciate it :))</p>
]]></description><link>https://forum.mango-os.com/topic/3031/pulling-multiple-parameters-from-a-single-json-result</link><generator>RSS for Node</generator><lastBuildDate>Wed, 22 Apr 2026 15:14:12 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/3031.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 24 Oct 2017 19:54:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Pulling multiple parameters from a single JSON result on Wed, 22 Nov 2017 22:08:24 GMT]]></title><description><![CDATA[<p dir="auto">Very powerful! I've definitely done many quick things by serializing data into an alphanumeric point with JSON.stringify(object) and getting it back elsewhere with JSON.parse(string)</p>
]]></description><link>https://forum.mango-os.com/post/16294</link><guid isPermaLink="true">https://forum.mango-os.com/post/16294</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Wed, 22 Nov 2017 22:08:24 GMT</pubDate></item><item><title><![CDATA[Reply to Pulling multiple parameters from a single JSON result on Wed, 22 Nov 2017 22:06:48 GMT]]></title><description><![CDATA[<p dir="auto">OMG man, I didn't realize what JSON.parse() did.... now I do... DAMN! :)</p>
]]></description><link>https://forum.mango-os.com/post/16293</link><guid isPermaLink="true">https://forum.mango-os.com/post/16293</guid><dc:creator><![CDATA[psysak]]></dc:creator><pubDate>Wed, 22 Nov 2017 22:06:48 GMT</pubDate></item><item><title><![CDATA[Reply to Pulling multiple parameters from a single JSON result on Wed, 22 Nov 2017 21:47:09 GMT]]></title><description><![CDATA[<p dir="auto">Thanks Phil, just trying to get back at this finally.</p>
]]></description><link>https://forum.mango-os.com/post/16292</link><guid isPermaLink="true">https://forum.mango-os.com/post/16292</guid><dc:creator><![CDATA[psysak]]></dc:creator><pubDate>Wed, 22 Nov 2017 21:47:09 GMT</pubDate></item><item><title><![CDATA[Reply to Pulling multiple parameters from a single JSON result on Tue, 24 Oct 2017 21:51:11 GMT]]></title><description><![CDATA[<p dir="auto">Hi Psysak,</p>
<p dir="auto">Also, you may consider using the HttpBuilder script utility. Then you can have the whole thing in a scripting data source, clean and tidy.</p>
<p dir="auto">There is documentation in the contextual help menu for "Mango Java Script" (which you can access through the scripting help, or the meta point help).</p>
<p dir="auto">Here's a thread where I posted something maybe more complex than what you're talking about: <a href="https://forum.infiniteautomation.com/topic/2999/intesis-integration" rel="nofollow ugc">https://forum.infiniteautomation.com/topic/2999/intesis-integration</a></p>
<p dir="auto">It sounds like yours may be as simple as...</p>
<pre><code>var headers = {}
var parameters = {}
function handleTemperatureData(data) { /* Do stuff */ }
HttpBuilder.get("https://someplace.wherever", headers, parameters).err(function(status, headers, content) {
  throw "Script failed with HTTP status: " + status;
}).resp(function(status, headers, content) { //needs to be 200 status or you can set the accepted statuses
  handleTemperatureData( JSON.parse(content) );
}).execute();</code></pre>
]]></description><link>https://forum.mango-os.com/post/15938</link><guid isPermaLink="true">https://forum.mango-os.com/post/15938</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Tue, 24 Oct 2017 21:51:11 GMT</pubDate></item><item><title><![CDATA[Reply to Pulling multiple parameters from a single JSON result on Tue, 24 Oct 2017 21:27:51 GMT]]></title><description><![CDATA[<p dir="auto">Hi Psysak,</p>
<p dir="auto">Both those should work. If you alphanumeric matches the whole response you can do something like <code>var response = JSON.parse(alphanum.value);</code> and then you can process it however you like. Then trigger the script on the context update of the alphanumeric point.</p>
]]></description><link>https://forum.mango-os.com/post/15935</link><guid isPermaLink="true">https://forum.mango-os.com/post/15935</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Tue, 24 Oct 2017 21:27:51 GMT</pubDate></item></channel></rss>