How to get current doc state

Can Anyone Help me out I am new to ProseMirror and I want to show current doc json along with texteditor I need to submit my assignment today Only.

Thanks in Advance

state.doc.toJSON()

Print with indentations: JSON.stringify(json, null, 2)