# Remove html tags / replace \<br\> etc with its html style (Create a break) from api response

**URL:** <https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145>\
**Category:** Questions about Thunkable X\
**Created:** [June 25, 2019, 11:21am UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145 "2019-06-25T11:21:54Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [June 27, 2019, 11:41am UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/21 "2019-06-27T11:41:59Z")

</div>

You need to clear the image code from unnecessary characters.

Bad code

`<img src = \ "https: //donegalnews.com/wp-content/uploads/2019/06/Donegal-fans-660x430.jpg \" alt = \ "\" width = \ "660 \" height = \ " 430 \ "class = \" size-website-image wp-image-66613 \ "srcset = \" https://donegalnews.com/wp-content/uploads/2019/06/Donegal-fans-660x430.jpg 660w, https://donegalnews.com/wp-content/uploads/2019/06/Donegal-fans-400x260.jpg 400w \ "sizes = \" (max-width: 660px) 100vw, 660px \ "/>`

Good code

`<img src = "URL" alt = "alternate text">`

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [June 27, 2019, 11:43am UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/22 "2019-06-27T11:43:53Z")

</div>

And how would I do that? Is it a simply if contains replace with nothing?

I would love to be able to display the images.

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [June 27, 2019, 11:45am UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/23 "2019-06-27T11:45:19Z")

</div>

You will first clear the image display code and then it will appear in the text.

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [June 27, 2019, 11:46am UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/24 "2019-06-27T11:46:34Z")

</div>

Okay. And does that display the image or just fix the text. thanks

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [June 27, 2019, 11:50am UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/25 "2019-06-27T11:50:14Z")

</div>

It seems that the web viewer no longer works. It just broke? I think before it wasn’t web viewer and just the label.

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [June 27, 2019, 11:52am UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/26 "2019-06-27T11:52:55Z")

</div>

WebViewer is different from system browsers. Not everything will work in it, which will work in system browsers. But your code does not display pictures, because you have a “dirty” code. It needs to be made pure html code.

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [June 27, 2019, 11:55am UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/27 "2019-06-27T11:55:35Z")

</div>

And by changing **`\`** to nothing it should work?

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [June 27, 2019, 11:58am UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/28 "2019-06-27T11:58:14Z")

</div>

Yes it should work. To check, use some kind of html editor.

> **[Online HTML Editor](https://html-online.com/editor/)**
>
> The best real-time online HTML editor software kit with dynamic instant live visual preview and inline WYSIWYG editor using CKEditor and markup clean-up feature

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [June 27, 2019, 12:03pm UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/29 "2019-06-27T12:03:59Z")

</div>

Still getting nothing in the web viewer. I think i was getting data before but i do not know why I get no input now.

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [June 27, 2019, 12:05pm UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/30 "2019-06-27T12:05:14Z")

</div>

Insert your plain text here [https://html-online.com/editor/](https://html-online.com/editor/). Pictures in the text are shown?

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [June 27, 2019, 12:06pm UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/31 "2019-06-27T12:06:37Z")

</div>

No, only when I clean it up. But in the app itself, the web viewer no longer shows the html 😕

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [June 27, 2019, 12:08pm UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/32 "2019-06-27T12:08:49Z")

</div>

Doesn’t work on Androyd?

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [June 27, 2019, 12:09pm UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/33 "2019-06-27T12:09:33Z")

</div>

no. Let me share my code.

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [June 27, 2019, 12:11pm UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/34 "2019-06-27T12:11:04Z")

</div>

[https://x.thunkable.com/copy/d149b9176aad48c02120276957393314](https://x.thunkable.com/copy/d149b9176aad48c02120276957393314)

It is on the “Full Article” page. The description is plain html code.

The Posts api link is: [https://donegalnews.com/wp-json/wp/v2/posts/?categories\_exclude=8367&per\_page=10&page=1](https://donegalnews.com/wp-json/wp/v2/posts/?categories_exclude=8367&per_page=10&page=1)

And the media api is already set for you in blocks.

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [June 27, 2019, 12:23pm UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/35 "2019-06-27T12:23:23Z")

</div>

Again. You need to clear the code of characters that do not allow displaying html correctly. As I understand it, the text you receive changes. Therefore, you need to throw out all these `\"` `\&quot;` `\n` and other dirt.

Do you understand what needs to be done? You must first clear the text, then check it at [https://html-online.com/editor/](https://html-online.com/editor/) and if everything is fine, then paste the text into WebViewe after that. Otherwise you will always have problems.

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [June 27, 2019, 12:37pm UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/36 "2019-06-27T12:37:38Z")

</div>

Okay. and when you say \ " &quot; \n  
do you mean them separately like this:

`\`  
`"`  
`&quot;`  
`\n`

and remove things like the html code for apostrophes and speech marks?

Thanks again

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [June 27, 2019, 12:40pm UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/37 "2019-06-27T12:40:17Z")

</div>

Yes

```
\" - "
&quot; - "
\n - empty string (delete \n)
```

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [June 27, 2019, 12:49pm UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/38 "2019-06-27T12:49:33Z")

</div>

I tried deleting them three things but no luck. Is there anywhere that i can find a full list of dirt to delete? Or do you have a list of the items.

Thanks

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [June 27, 2019, 12:54pm UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/39 "2019-06-27T12:54:31Z")

</div>

I have no such list. Dirt is created with escape characters. It is necessary to replace `\/` on /

---

<div class="post-metadata">

**Author:** ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)\
**Post date:** [June 27, 2019, 12:55pm UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/40 "2019-06-27T12:55:43Z")

</div>

so if contains `\/` replace with /  
?

[Previous page](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145.md?page=1)

[Next page](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145.md?page=3)
