nafeeur10's avatar

How to convert Quill Rich Text data from database to Normal Text in Vuejs

Quill Rich text give this type of data.

{"ops":[{"insert":"amar sonar bangla"},{"attributes":{"header":1},"insert":"\n"},{"insert":"\n"},{"attributes":{"bold":true},"insert":"ami tomay valobashi"},{"insert":"\n\n"},{"attributes":{"bold":true},"insert":"oh"},{"attributes":{"list":"ordered"},"insert":"\n"},{"attributes":{"bold":true},"insert":"hjlohj"},{"attributes":{"list":"ordered"},"insert":"\n"},{"attributes":{"bold":true},"insert":"33klljk"},{"attributes":{"list":"ordered"},"insert":"\n"}]}

Data will come from Database. I can save data from Quill to Database.

Now how can I convert them into normal real text in Vuejs?

0 likes
2 replies
Tray2's avatar

If it returns a json string which it seems to do you need to parse it into and object and then you can refer it like you would any other object.

let something = JSON.parse(myJson);

something.title
nafeeur10's avatar
nafeeur10
OP
Best Answer
Level 5

Solved my problem.

  1. Save data as innerHTML
  2. Then <div v-html="content"></div>

Solved!

1 like

Please or to participate in this conversation.