It's convention, more or less. That's the way JSON comes out of Rails. We may not do the escaping in the next version of the API, if it's problematic.
On Tue, Jan 6, 2009 at 12:21, Chris Thompson <[email protected]> wrote: > > If I grab the JSON that's returned by the /users/show method, all > forward slashes in URLs are escaped. > > For example, the profile_image_url for my net_twitter id returns: > > http:\/\/s3.amazonaws.com\/twitter_production\/profile_images\/ > 29624212\/ > > I originally found this when I noticed that something I was doing was > RE-escaping the backslashes as \\ giving me: > > 'profile_image_url' => > 'http:\\/\\/s3.amazonaws.com\\/twitter_production\\/profile_images\\/ > 29624212\\/twitter_normal.jpg' > > I've fixed that part and it's no longer double escaping, but it makes > me wonder why it's being escaped at all. I don't think JSON requires > it. It certainly doesn't need escape in the body of an HTTP response. > I can't imagine rails makes you do it. > > The only thing that I can think of is that it's escaped for the XML > side of things, which makes sense, I guess. > > What's the scoop? > -- Alex Payne - API Lead, Twitter, Inc. http://twitter.com/al3x
