Decode Json urls

2019-09-19 13:39发布

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.

1条回答
▲ chillily
2楼-- · 2019-09-19 14:15

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

查看更多
登录 后发表回答