SpaceApi-archive / SpaceApi

Android app and widget showing hackerspace status
18 stars 10 forks source link

to escape or not to escape? #4

Closed sonologic closed 11 years ago

sonologic commented 12 years ago

I am also not sure why the example includes both "http://" as well as "http:\/\/". JSON specifies \/\/, though apparently a bunch of libraries do not implement this encoding (including, incidentally, node.js :-/)

slopjong commented 12 years ago

Both are valid. Don't worry about escaped and non-escaped slashes.

rohieb commented 12 years ago

But then it should also be

    "wind":[{"name":"outside", "speed":0.3, "gust": 1, "unit":"m\/s", "direction":"SE"}],

and

   "feeds":[
     {"name":"blog","type":"application\/rss+xml","url":"https:\/\/revspace.nl\/blog.rss"},
     {"name":"calendar","type":"text\/calendar","url":"https:\/\/revspace.nl\/revspace.ical"}
   ],
slopjong commented 11 years ago

As already said, both are valid in JSON. Some libraries are reencoding automatically whilst others don't. Every library should read both variants, otherwise they're not working correctly.