rencsaridogan rencsaridogan - 4 years ago 147
JSON Question

JSON, Link Gets Broken

I'm using JSON for some Android Application. I am trying to store links in JSON but they are getting broken inside JSON like below :

11-21 01:15:52.080: D/output(3775): "video_url": "http:\/\/\/bunny.mp4",

I'm putting data like below :

jsonObject.put("thumb", "");
jsonObject.put("url", "");
jsonObject.put("name", "Bunny");

Anybody has any ideas about this problem?

Answer Source

The strings in JSON are getting escaped. You can either write a simple function to unescape them yourself or use a library which has built in functions like GSON or Jackson.

I personally used this library in the past

It provides a function: unescapeJson(String) which will give you your original links back. Just include it in your project and call the method.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download