Passing JSON Object to Module

I'm a newbie to this. I have a JSON object in globals that I am using in OSC. I'd like to Save and Reload when I start up a new session. How do I pass the object to the module and trigger the Save or Reload.

This is the object I'm using in OSC

globals.scenes =

globals.InitScenes = function(){
for (let i = 1; i <= 8; i++) {
var scene = { "id": "s" + i,"value":""}
globals.scenes.push(scene)
}
}

And I can see that you you can use SaveJSON -

I'm not sure how to wire them up and get them talking to one another

The custom module and the clients communicate using osc messages :

  • messages sent by clients can be caught in the custom module's oscOutFilter function
  • the custom module can send messages to the clients using the receive() function that generates a message as if just received (except that it won't be passed to the oscInFilter function)

This example, although a bit different from your use case, might give you some hints as to what's possible : GitHub - jean-emmanuel/osc-state-example

Thanks very much.

This works perfectly and taught me the basics of how modules interact with OSC