DatoCMS API structured text to string

Is there a method somewhere that reads structure text field value as a string in Javascript client ?

I am doing a search-index with Javascript client and would love to extract plain text from structure fields.

Thanks,
Primoz

Hello @primoz.rome i think you are looking for this right here: datocms-structured-text-to-html-string - npm

1 Like

Not 100% perfect, but it will do. I can easily strip Html tags from the content…

There is also a package which should exactly do what you want:

https://www.npmjs.com/package/datocms-structured-text-to-plain-text

2 Likes

Exactly @mjablonski, thank you!
I had forgotten about that.

And welcome to the community by the way :slight_smile:

Uh yes @mjablonski , this one is exactly what I need. Super!