Reputation: 3843
I'm parsing JSON from an API but in the strings I get back, I get "&qout;" For example, I have a string that is returned that says "The movie &qout;Her&qout; is a spectacular movie."
I want it to say "The movie 'Her' is a spectacular movie" but I have no idea how to update the string that is being returned from the API before I display it to the user in a TextView. The actual string in the JSON return includes ". I get the string through JSON parsing and I don't know if that makes things more difficult.
Any help is appreciated. Thanks.
Upvotes: 1
Views: 3563
Reputation: 55
You can also use
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Html.fromHtml("`The movie "Her" is a spectacular movie.`", HtmlCompat.FROM_HTML_MODE_LEGACY)
} else {
Html.fromHtml("`The movie "Her" is a spectacular movie.`")
}
Upvotes: 2
Reputation: 528
You could always parse your string and replace the "
with '
string.replace(""", "'");
I know it's not very elegant, but it gets the job done. But, along with what DIVA is asking, a valid question might be: why are you getting " in your JSON response from the API?
Also, you didn't mention if you were using a 3rd party JSON parser or the built in JsonReader?
Upvotes: 2