dataTypes
I have read data from a JSON file into a Coll object, but the data is the wrong type, so I need to use 'from symbol' to collect it from the coll. Any tips on changing the data type in javascript?
I tried Number.parseFloat() but that did not seem to do anything - the way I used it anyway.
This question is pretty vague. It's hard to guess the problem without knowing more about your code and the data you're dealing with.
That said, I will say that using push_to_coll from a Dict (if that's what you're doing...), will always create keys in the coll that are symbols and not integers. In that case you may need to loop through your data in the javascript and format messages to the coll object to populate it exactly how you want. Or just use a little Max code to dump the coll afterward and re-insert all the same data after converting the key symbols into integers.
I tried to use the Dict import_json. It works for the MAXMSP example file colors.json but not for the file I am using (LIGO data from Caltech, which is .json files (!)) So instead I read the file into a new object, UI, and use this bit of code:
UI = JSON.parse(memstr);
}
function dump(){
var d = new Dict;
for(i in UI){
d.append(i,UI[i]);
d.push_to_coll("data");
}
}
Is d.append the place where I could change types? How would I do that? (sorry but I am a real beginner with Javascript - I tried to fiind information about typing, but JS seems rather lax).