#How can I properly store Tiptap's deeply nested JSON editor content in a table?

14 messages · Page 1 of 1 (latest)

fast sleet
#

I have rich text editor that outputs json formated data, the more formating the crazier the json.
Should i keep doing this? Im getting warning of deep nesting at level 16

  content: [
    {
      content: [
        {
          marks: [
            {
              attrs: { color: "rgb(0, 0, 0)" },
              type: "textStyle",
            },
          ],
          text: "actual random text (this can get really crazy",
          type: "text",
        },
      ],
      type: "paragraph",
    },
  ],
  type: "doc",
}
swift lichen
#

Is it too big to stringify?

#

The nesting probably isn't meaningful from a database perspective.

fast sleet
#

i asked gpt and it said if i stringified it would hurt query time, and indexing

swift lichen
#

I would try it, gpt don't know 'bout us lol

fast sleet
#

ok i will try it. it would remove the nesting problem correct

swift lichen
#

I don't know for sure, but I imagine storing complex structured data has it's own penalty.

fast sleet
#

its not a problem keeping it nested for me, as it is a internal tool i can just ask people to not go crazy on the rich text editor

#

i was wondering how google docs does it since you can format as much as you would like

swift lichen
#

Stringifying json is surprisingly fast in my experience, even in the browser.

#

It's also going to be sent to your function as a string anyway, might as well keep it that way. I'd stringify it right in the browser personally.

fast sleet
#

ok i will definitely try stringing it. only thing i lose is if i need to search inside it correct?

swift lichen
#

Yeah you wouldn't be able to do any object level operations on the data at rest, but I'd be surprised if that was actually happening anyway