Hi MaP,
Is the key "prices" unique in the JSON? If so, you could use a regex like.... "prices": (.*?\}\]) I think, value index 1. That'll capture the list, which can then be parsed in a script...
if( scriptRuntime.time < httpPoint.time ) {
var pricesList = JSON.parse( httpPoint.value );
for( var k = 0; k < pricesList.length; k+=1 ) {
var time = Date.parse( pricesList[k].starts );
if( isNaN(time) )
continue; //Consider error handling?
outputPoint.set( priceList[k].spotEnergyPriceDollarsPerMWh, time );
}
scriptRuntime.set( scriptRuntime.value + 1 );
}
Where output point is either a numeric scripting point or a settable virtual point, and scriptRuntime is a multistate scripting point I am setting to see if newer data has arrived. You may wish to turn that point to not log. You could also do something in the loop like if( time <= outputPoint.time ) continue; to prevent extra work. The script would be on a cron similar to the polling rate of the http data source.
Edit: In Mango 3.2 (which should be released next week) we've added the ability for scripting points to trigger the script, which would eliminate the need for the scriptRuntime point. We've also added the ability for meta points or point links to call the set() function.