Max depth reached

I’m running into problems when parsing JSON strings containing the text of a global structure-type variable. After parsing and storing in a scene variable, I can see the structured variable, but the data ends abruptly with a “Max depth reached” error:

…and here’s the code:

That’s probably just the debugger. If you print ToJSON(sceneDataStruct) to the console, you should see the full structure being intact. The debugger limits how much data it can gather from the game to avoid crashing or overloading its connection to the game.

1 Like

@arthuro555, thanks for the quick reply. That’s good news! I’ll proceed, and debug to console as you suggest. Thank you.

OK, I’m stuck.

I’ve searched for help doing what you’ve suggested:

" If you print ToJSON(sceneDataStruct) to the console, you should see the full structure being intact. "

Then I messed around with the console, and used google to try to do it, but I still don’t know how.

Assuming you were referring to invoking my game’s browser window with Ctrl+Shift+I, what command from the console should I be using to print the variable contents to the console? I’ve tried using Print(), console.log(), and other methods, including pasting your instructions verbatim. I’m getting various errors, such as:

Side Note: if this is an important troubleshooting or debugging method, should there ideally be some GDevelop resources for doing this? As I said, all of my searches turn up pretty empty for interacting with the console. It seems like there’s a lot to understand, such as:

  • Using the debug console from within the GDevelop IDE, normal mode
  • Using the debug console from within the GDevelop IDE, strict mode
  • Using the game’s browser window console mode (Ctrl+Shift+I), which seems to be JS/PIXIE.js, correct?

Any help would be appreciated.

ToJSON() is an expression you can use in any string field. It’s not for direct use in the debugger or console.

You can use the “log message to the console” action and use the ToJSON(YourVariableHere) expression.

OK, that helps! I tried it, and was able to deliver the full, complete variable data to the console. Thanks!