The Rich text editor in the content model should actually give out data to the api in a json format but the data i am receving is in raw form i tried making a new content model tried adding two rich text field but none the above worked for me
ps: I am trying to make a blog post content model
Below in the Picture the body is the Name of the richtext editor field:
I tried using npm package of contentful to react component render but for that the data passed through api should have Json format but the data i am receiving is in raw format.
I am facing the same issue and I could not render with raw type
Hey, Did you find any solution for this ? I am currently using Markdown editor in contentful Which is not the best compared to the rich text editor.
I was having trouble with this until I figured out that I could just put the raw data into JSON.parse() before passing that all into documentToReactComponents()
In the end, it looked like
{documentToReactComponents(
JSON.parse(props.data.contentfulBlogPost.body.raw)
)}
After that, my webpage ended up loading all my body content, yey
I came up with the same solution as above to use JSON.parse(). This worked great for everything except for embedded assets. I cant figure out how to access the nodes for images, would be much easier to figure out why the query is returning raw instead of json in the first place.
im also facing the same issue. How do I fix this. Target.Fields is not available in embedded-asset-block
Me too.
I am trying to get my Gatsby blog off the ground and I am currently having this issue. Running http://localhost:8000/___graphql I only have the option for Raw.
I understand I also need the Rich Text renderer that’s fine, but I need JSON to work in the query and that’s just not happening…
@kevinbellock: you are spot on — need to get that JSON!
Really don’t want to go down the JSON.parse() road as it looks like that’s not ideal based on Kevin’s experience.
Anybody?
@jay90194 - are you using Gatsby to query Contentful. If so, you’re probably using the gatsby-source-contentful plugin which now returns raw
instead of json
.
Here’s a good post on how to query data using the gatsby-source-contentful plugin.
You need to query images and embedded objects differently too but you can get these included in the graphQL payload.