Multiple people have asked for a feature to decode messages in a JSON format and I’d love to receive a PR that does such a thing.
But even with such a feature you probably won’t be able to persist Yjs in a queryable format (unless you reimplement Yjs to work directly on a database, which would require you to be very familiar with the inner workings of YATA & Yjs). Before you can read the document you must apply all updates that were ever created. This is just how Yjs, and similar CRDTs for linear structures work.
A better solution is to extract data from the Yjs document and store that in a queryable format into the database. For example, after each change (after a debounced timeout), you could load the Yjs document to memory, extract the data you are interested in, and store that in a database.
Alternatively, you could have a look at Riak or AntidoteDB. They use CRDTs to resolve conflicts directly on the database.
If you are interested in the inner workings of Yjs you could have a look at some internal information I published here: https://docs.yjs.dev/api/internals