Try something like this:
var widget = JSON.parse(json_string);
var window_content = widget.debug.window;
widget.debug = window_content;
var new_json_string = JSON.stringify(widget);
edit: removed widget.debug.window = false;
since replacing widget.debug will remove it, and setting it to false would make it appear again as “false”.
3
solved JSON object within JSON objects in Node.js [closed]