Search code examples
jsonreact-nativewordpress-rest-api

How to render content of wordpress api?


I am creating a mobile app for a wordpress solution, while studying wordpress rest api, I have found a problem with the way the json schema is rendered;

while /wp-json/wp/v2/posts displays all posts but it is in this format

"title": {
    "rendered": "testing rest api & #8220;tesint-restAP& #8221;"
 }, 

How to extract the actual content from response.data.content because it came as html version with tags and such ???.enter image description here


Solution

  • First, get your json data with its html tags, then

    var StrippedString = OriginalString.replace(/(<([^>]+)>)/ig,"");