I am parsing large json files, and want to wait until the monster-file I am parsing has been parsed. Is there any way to let such processes signal something to see (e.g. in the post window) to know when it is safe to proceed with the rest?
One way is to use your own function:
(
// using a function
f = {arg jsonString;
a = jsonString.parseJSON;
"Finished parsing JSON".postln;
};
f.value("{ \"a\": 1 }");
a.postcs;
)
This might seem to work for a simple json-string, but does the parseJSON method also blocks the thread for a large json-file till it’s done parsing it?
I’m not sure. Maybe try it with one of your files:
(
f = {arg jsonFile;
a = jsonFile.parseJSONFile ;
"Finished parsing JSON File".postln;
};
f.value("path/to/file/XXXX.json"); //change to valid path
a.postln;
)
I’m pretty sure it does. Especially when it’s a = jsonFile.parseJSONFile – there is no way to advance to the a assignment until parsing is finished.
hjh