0

I'm downloading a JSON from the Google Directions API. For the HTML_Instructions field, representing the actual instruction needed for navigation, here is the format:

"Head \u003cb\u003esoutheast\u003c/b\u003e on \u003cb\u003eMinor Ave\u003c/b\u003e toward \u003cb\u003eMadison St\u003c/b\u003e",

Is there a way to decode/remove the escape characters from the String that is downloaded in Java/an Android application.

Thanks for the help.

f3d0r
  • 541
  • 3
  • 12
  • 27

1 Answers1

4

In Java use

String result = java.net.URLDecoder.decode(url, "UTF-8");

In JS use decodeURIComponent

document.write(decodeURIComponent("Head \u003cb\u003esoutheast\u003c/b\u003e on \u003cb\u003eMinor Ave\u003c/b\u003e toward \u003cb\u003eMadison St\u003c/b\u003e"))
mplungjan
  • 169,008
  • 28
  • 173
  • 236