Can't figure out a way to escape quotes in json in YouTube API

Viewed 458

I am using the YouTube API and I'm using Python urllib2.urlopen() to send a GET request. Then I pass the result to Javascript. (I'm using Django)

So, something like this:

result = urllib2.urlopen('https://gdata.youtube.com/feeds/api/videos?'+query+'&max-results=1&alt=json')

I'm using jQuery to parse the JSON formatted response, however some YouTube videos/descriptions have double quotes and this breaks the parseJSON() function.

Any help would be highly appreciated.

1 Answers
Related