Also so schaut mal meine Lösung aus:
on({id: 'javascript.0.Sprit.Sprit_JSON'/*Sprit JSON*/, change: 'any'}, function(obj)
{
var index = 0;
/*var gasStation = JSON.parse('parser.0.Tanken');*/
var gasStation = JSON.parse(obj.state.val);
/*if (gasStation.length === 0) return;*/
console.log((String('Durchlauf')));
createState("javascript.0.Sprit.Tankstelle_Test.Index", false,{type: 'number',name: 'index', read: true,write: true});
for (index = 0; index < gasStation.length; ++index) {
createState("javascript.0.Sprit.Tankstelle_"+index+".Index", 0,{type: 'number',name: 'index', read: true,write: true});
setState("javascript.0.Sprit.Tankstelle_"+index+".Index", gasStation[index].id);
createState("javascript.0.Sprit.Tankstelle_"+index+".name", 0,{type: 'string',name: 'name', read: true,write: true});
setState("javascript.0.Sprit.Tankstelle_"+index+".name", gasStation[index].name);
createState("javascript.0.Sprit.Tankstelle_"+index+".prices", 0,{type: 'string',name: 'Preis ges', read: true,write: true});
if ((gasStation[index].prices[0])!=undefined){
setState("javascript.0.Sprit.Tankstelle_"+index+".prices", (gasStation[index].prices[0].amount).toString().replace(".",","));
};
createState("javascript.0.Sprit.Tankstelle_"+index+".adresse", 0,{type: 'string',name: 'name', read: true,write: true});
setState("javascript.0.Sprit.Tankstelle_"+index+".adresse", gasStation[index].location.address);
createState("javascript.0.Sprit.Tankstelle_"+index+".adresse2", 0,{type: 'string',name: 'name', read: true,write: true});
setState("javascript.0.Sprit.Tankstelle_"+index+".adresse2", gasStation[index].location.postalCode + " "+ gasStation[index].location.city);
}
});
Sortiert nur nach billigst zu teuer.