0

I'm manually parsing Json objects using java and I have a problem with urls.

They currently look like this:

http:\/\/a3.sphotos.ak.fbcdn.net\/hphotos-ak-ash4\/...

and I was wondering how to decode them into a normal form that I can further use, like this:

http://a3.sphotos.ak.fbcdn.net//hphotos-ak-ash4//...

It's not just the slashes that cause this problem, so simply searching for them is not a solution. I'm searching for a standard method from the jdk that could easily accomplish this.

Unfortunately I have know idea what the encoding is called, so I can't be more specific in what I want to know.

Mike Samuel
  • 118,113
  • 30
  • 216
  • 245
kohlehydrat
  • 503
  • 1
  • 3
  • 19
  • Why parse JSON manually? Unless it's for learning, it sounds a bit like reinventing the wheel http://www.json.org/java/ – Pekka Mar 06 '11 at 16:00

1 Answers1

2

Looks like you should try and use the answer from here:

unEscape JavaScript escaped value in JAVA

There seems to be an unescape function. I have used that before in javascript (unescape) to help with the same issue. Looks like Java has a similar function.

http://commons.apache.org/lang/api-release/org/apache/commons/lang/StringEscapeUtils.html

Community
  • 1
  • 1
Jamie R Rytlewski
  • 1,172
  • 9
  • 22