iframe receives message from parent window but console.log returns [object MessageEvent]

I’m sending messages from the parent window to the iframe, but when I log the message inside the iframe, it returns [object MessageEvent].

I’ve tried to parse it with JSON.parse and it produces a parse error, but when I try JSON.stringify it prints the string representation of the message correctly.

Can I access the object without doing JSON.strinfigy?

From the Parent window, I’m not sending JSON string. I’m sending an object.

Below is my code in parent window

frame.contentWindow.postMessage({
  action: 'start', 
  config: {onlyWithImages}
}, '*')

and inside the iframe I’ve this code

window.addEventListener('message', e => {
  let data = e.data
  console.log(data) //[object MessageEvent]
}