Converting nodes that are not present in the schema

I use two schemes on my site: one for posts, the other for comments. Comments are missing some formatting options, such as lists or tables. In some cases, the content of a post created with an extended schema can be submitted for editing to the comments editor. In this case, I would like node types that are not present in the comment schema to be converted to plain text, similar to what happens with cut and past. However, when trying to parse content like this

let doc: Node|undefined;
if (content) {
    try {
        doc = Node.fromJSON(schema, JSON.parse(content));
    } catch (error) {
        console.error(`Can not parse Prose format: ${error}`);
    }
}

exception is thrown to nodes that are not present in the schema. Is there a way to convert missing nodes in the schema?

As a result, I simulated inserting a document into the editor from a clipboard

export const toSimpleSchema = (content?: string|null): Node | undefined => {
    if (!content) return;
    try {
        const doc = Node.fromJSON(schema, JSON.parse(content));
        const dom = DOMSerializer.fromSchema(schema).serializeFragment(doc.content);
        return DOMParser.fromSchema(simpleSchema).parse(dom);
    } catch (error) {
        console.error(`Can not convert content to simple schema: ${error}`);
    }
};

Node.fromJSON expects a JSON document that matches the given schema. If you want to do any conversion or removal of nodes, you’ll have to implement that as a conversion pass on the JSON document before you feed it to Node.fromJSON.