WordPress JSON API – remove characters from content

I am using WordPress JSON API plugin to get my posts as json. I am using that data for my AngularJS project. How to remove characters and p tags from content part of post that I get via JSON api.

<p> Lorem ipsum text “times” </p>

So I can on my page just show:

Lorem ipsum text "times"

Related posts

Leave a Reply

1 comment

  1. I had the same problem but then realized that I was appending the content as textNode. After I set it as innerHTML it worked.

    So, my wrong code was:

    var content = document.createElement('div');
    content.setAttribute('class', 'story');
    var contentText = document.createTextNode(post.content);
    div.appendChild(contentText);
    

    Correct code:

    var content = document.createElement('div');
    content.setAttribute('class', 'story');
    content.innerHTML = post.content;
    

    Hope it will help someone.