# 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:** 1

<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 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/1 "2019-06-25T11:21:54Z")

</div>

I am pulling data from a wordpress website and I get tags like these:

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/1/0166cbc2ba7279da024d2867ed9fa0d8ff818704.png)

I had to upload an image because they are html tags and they only show what it is meant to be such as an apostrophe or speech marks.

I am wondering, is there any way to remove html tags in thunkable x? If not where is the best place to find the most common html tags so I can use the replace text block and just make a load of them.

All comments are much appreciated!

---

<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 25, 2019, 11:31am UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/2 "2019-06-25T11:31:18Z")

</div>

To clear the tags you need to create your own algorithm. For example, lines of the form `&#1234;` are deleted like this: find the left position of the next line “&#” and then the right position - the symbol “;”. After that, delete the substring from the left position to the right one inclusively.

Similarly, tags are deleted, only you need to look for the characters “\<” and “\>”.

---

<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 25, 2019, 12:02pm UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/3 "2019-06-25T12:02:50Z")

</div>

If one of these tags includes a " or something of that like, would they be automatically replaced by thunkable app? 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 25, 2019, 4:35pm UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/4 "2019-06-25T16:35:17Z")

</div>

Sorry, but I did not understand your question. Removing or replacing something will happen as you programmed in blocks.

---

<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 25, 2019, 4:37pm UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/5 "2019-06-25T16:37:45Z")

</div>

The label shows up things like _\< p \>_ and _\< /p \>_ and I think for _\< br \>_ as well. I need it to show it as it would look in html. I am linking to a wordpress blog and the blog of course contains things like this, and the json from the wordpress site sends me this data but i need the label to interpret it or remove it. i would rather it acted like html though.

---

<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 25, 2019, 5:30pm UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/6 "2019-06-25T17:30:59Z")

</div>

I understand correctly that you want to keep some tags and remove others? If so, then either make exceptions when searching and replacing tags, or first convert the non-removable tags to unique characters, delete the rest, and finally do the reverse conversion.

---

<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 25, 2019, 5:37pm UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/7 "2019-06-25T17:37:22Z")

</div>

I have exceptions for tags that look like […] and speech marks and all that stuff, and I have set them to replace with what they mean, if you get me?

But it is really important that I get the paragraphs as it is a news article that I am dealing with.

Thanks again for your help, i really do appreciate it!

---

<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 25, 2019, 10:46pm UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/8 "2019-06-25T22:46:50Z")

</div>

here is an example of the data that i am dealing with.

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/0/e0b3d2a7fc760f770da073330d187bdbfa2463a6.png)

I need it to show as it would in a html viewer. 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 26, 2019, 8:18am UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/9 "2019-06-26T08:18:08Z")

</div>

To display this text as in a browser, you need to use WebViewer and the data URI protocol.

An example is shown on the scrHtml screen.

[https://x.thunkable.com/projects/5cd84f23e3097f3353fdad45/project/properties/designer/](https://x.thunkable.com/projects/5cd84f23e3097f3353fdad45/project/properties/designer/)

---

<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 26, 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/10 "2019-06-26T12:08:39Z")

</div>

In your example you join the html together. Does this matter? I just have one massive string.

---

<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 26, 2019, 12:12pm UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/11 "2019-06-26T12:12:56Z")

</div>

This is my code: ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/0/900e2cd3a3e2bc9af2ff2e75eaf39b888c85ba23.png)

App description is the text that I have above but it still does nothing. I changed it to URI protocol in the advanced settings.

---

<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, 8:06am UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/12 "2019-06-27T08:06:22Z")

</div>

You can give me your text in txt format, which I can copy, and look at their devices.

---

<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, 9:40am UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/13 "2019-06-27T09:40:24Z")

</div>

Certainly.

The texts vary so here are 3 examples.

[Examples.txt](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/2/9246a785b43798e4da6ee2b11342c76ec58e3103.txt) (13.5 KB)

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, 11:15am UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/14 "2019-06-27T11:15:27Z")

</div>

I looked at examples. Take the second text example. I added it to the WebViewer and in iOS on Live, paragraphs and characters \ n between them are displayed.

 ![%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0fbbfc0e2dddfa6c5ee33a165aae0070bb1d1d32.png)

Other texts are also displayed without problems. What is your problem and in what case?

---

<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:24am UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/15 "2019-06-27T11:24:43Z")

</div>

I set that text now as the url and i get nothing

---

<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:25am UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/16 "2019-06-27T11:25:12Z")

</div>

can you share a photo of your code for that, if there is any? Thanks

also i am on android 9, samsung one ui, device is samsung s8

---

<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:28am UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/17 "2019-06-27T11:28:07Z")

</div>

Also does the image show up in the text?

---

<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:31am UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/18 "2019-06-27T11:31:42Z")

</div>

In my example, the data URI is used. If you paste the text in the URL, it does not show anything.

Images are not displayed, because you need to fix the html code for them - everything `\"` replace on ".

[https://x.thunkable.com/projects/5d14a294922190073307f81d/project/properties/designer/](https://x.thunkable.com/projects/5d14a294922190073307f81d/project/properties/designer/)

---

<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:33am UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/19 "2019-06-27T11:33:50Z")

</div>

ahh okay. I understand now. You joined the data uri thing at the start, then the actual html code that I got.

---

<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:39am UTC](https://community.thunkable.com/t/remove-html-tags-replace-br-etc-with-its-html-style-create-a-break-from-api-response/120145/20 "2019-06-27T11:39:01Z")

</div>

So is there a way to add images into the html? And here is what I am getting now in web viewer:

 ![Screenshot_20190627-123706_Thunkable](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/9/291e753006f2e9f34befb44b6dd5a074166ee8a5.jpeg)

Photo links still show, and i get the html tags for things like speech marks and apostrophes.

And thank you for this help. I really do appreciate it!

[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=2)
