Skip to content Skip to sidebar Skip to footer

How To Remove

,

And
Which Are Obtained By Parsing Json Response

I got JSON response from server parsing json response i got content which contains

and how to replace all with blank or white space?

Solution 1:

You can just use the replace function? Or is that too easy..

For example:

json = json.replace("<br />", " ");json = json.replace("<p>", " ");json = json.replace("</p>", " ");

I don't know how your json looks like before this replacement. But it could of course be possible that you have &lt;br /&gt; instead of <br />. In that case you have to of course change the replacement tags.

It could also be possible you will have to use regexes. I don't really know off the top of my head how this is done, but you can Google this

Solution 2:

Try this, it will solve your problem.

Stringstr = "<p>Your String</p>";
Spanned sp = Html.fromHtml(str);

And see below link for more information.

How to preserve HTML in formatted strings

Solution 3:

Try mystring.replace("<b>", "");

Also, you can replace <br /> with \n.

Post a Comment for "How To Remove

,

And
Which Are Obtained By Parsing Json Response"