Save a JS object to a database field

Is there any way to save a JS object to a docfield? What docfield is the right choice? Code? Long text? Is there a character limit I need to worry about?

what are you trying to do with that,a little brief can help people to help you

This is a planning-stage question for the Desk 2 interface that I’m working on. I need to store the user menu preferences as some JSON-like object both in the browser and in some persistent state in the database. Because of the variation in the possible structures (literally, user defined), there doesn’t seem to be a way to “just handle” this the way there might be in a NoSQL DB. I anticipate that this object won’t be more than 200 lines, though theoretically it could be about 100,000 (~300^2 doctypes).

So MariaDB supports some kind of masking for JSON as long text, which would be fine for my purposes. The problem is that Frappe usually wants to handle JSON-y things as JSON when it moves them around. I’m not sure how to defeat this.