Weird javascript behavior when exporting patch to Application

lightspeed.johnny's icon

I have a patch that I would like to export as an Application. It works perfectly when running inside Max 7.

There is a javascript component to the patch which reads in a .json file, converts it to a javascript object, parses the js object and extracts some parts, and then converts the parsed parts to a dict object.

This all works perfectly when running inside of Max. However, when I export as an Application, I get an error when the App loads - I am using JSON.parse() to parse the string which is read into javascript.... JSON.parse() seems to be undefined when running as an external Application.

You would think that if JSON.parse() is not included in the Max javascript library it wouldn't work when running inside of Max. The weird thing is that JSON.parse() works perfectly fine when running inside of Max.

JSON.parse() is like 5 years old now... certainly should be part of any javascript run-time.

So then I attempted to move onto the UGLY eval() option... and now I get a lovely Crash whenever I try to run the exported application. Here are some relevant parts of the crash report:

Crashed Thread:        0  CrBrowserMain  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x00000000756c4226

VM Regions Near 0x756c4226:
    __LINKEDIT             000000000d937000-000000000d938000 [    4K] r--/rwx SM=COW  /Users/USER/Desktop/*/APC40-with-better-eval.app/Contents/Resources/C74/jsextensions/msp/jsbuffer.mxo/Contents/MacOS/jsbuffer
--> 
    MALLOC_TINY            000000007ae00000-000000007b000000 [ 2048K] rw-/rwx SM=PRV  

Thread 0 Crashed:: CrBrowserMain  Dispatch queue: com.apple.main-thread
0   com.cycling74.js                  0x0d10c2da js_reporterror + 177
1   ???                               0x2e312220 0 + 774971936

I know this is not the best place to report bugs, but wanted to see if anyone else has had a similar experience before reporting as a bug to C74.