Remove HTML From A String (in JSON Response)
var json = { 'Item': { 'Items': { 'Body': '
Solution 1:
I think all you need is a simple regex to strip html style tags from the content. Try this.
str.replace(/<\/?[^>]+>/gi, '')
Solution 2:
This should do the magic http://jsfiddle.net/Ygfvp/ Anyway it won't strip the html comments
Solution 3:
If you're mapping Json using React, then you can just leave the html tags and put them to use.
Instead of:
<div>{el.content.rendered}</div>
Do this:
<div dangerouslySetInnerHTML={{__html: el.content.rendered}}></div>
Post a Comment for "Remove HTML From A String (in JSON Response)"