If you have nested JSON.parse statements and need to have a nested JSON string, the inner string needs 3 backslashes to escape the double quote.
For example if this was the entry point of your application:
(async () => {
const event = JSON.parse(
JSON.parse(process.argv.slice(2)[0]).Message,
) as MyEvent;
processEvent(event);
})();
You would want to call this with a JSON string that looks something like this:
PS C:\_projects\eventProcessor> node dist\eventProcessor.js '{\"Message\":\"{\\\"myAttribute1\\\": \\\"myValue1\\\", \\\"myAttribute2\\\": \\\"myValue2\\\"}\" }'
Note that in windows the JSON string starts and ends with a single quote and has double quotes around the attributes and values within the object. Also, the inner string (i.e. Message object) needs to have the double quotes escaped with three (3) backslashes.