{"action":"created","issue":{"url":"https://api.github.com/repos/square/retrofit/issues/754","labels_url":"https://api.github.com/repos/square/retrofit/issues/754/labels{/name}","comments_url":"https://api.github.com/repos/square/retrofit/issues/754/comments","events_url":"https://api.github.com/repos/square/retrofit/issues/754/events","html_url":"https://github.com/square/retrofit/issues/754","id":58112846,"number":754,"title":"Feature request: Escaping { and } in url","user":{"login":"oliverhausler","id":8090341,"avatar_url":"https://avatars.githubusercontent.com/u/8090341?v=3","gravatar_id":"","url":"https://api.github.com/users/oliverhausler","html_url":"https://github.com/oliverhausler","followers_url":"https://api.github.com/users/oliverhausler/followers","following_url":"https://api.github.com/users/oliverhausler/following{/other_user}","gists_url":"https://api.github.com/users/oliverhausler/gists{/gist_id}","starred_url":"https://api.github.com/users/oliverhausler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oliverhausler/subscriptions","organizations_url":"https://api.github.com/users/oliverhausler/orgs","repos_url":"https://api.github.com/users/oliverhausler/repos","events_url":"https://api.github.com/users/oliverhausler/events{/privacy}","received_events_url":"https://api.github.com/users/oliverhausler/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-02-18T19:09:45Z","updated_at":"2015-03-04T17:32:04Z","closed_at":null,"body":"I am using retrofit to access the Facebook API. Because Facebook uses curly braces {} within their query syntax (and retrofit does too), it is quite confusing to write against the Facebook API.\r\n\r\nhttps://developers.facebook.com/docs/graph-api/using-graph-api/v2.2#fieldexpansion\r\n\r\nThis is how a Facebook request looks like:\r\n\r\n    @GET(\"/me?fields=id,email,first_name,gender,last_name,link,locale,name,timezone,verified,picture.type(large){is_silhouette,url},age_range\") JsonObject getUser(@Query(\"access_token\") String userToken);\r\n\r\nBut because retrofit expects a parameter within {} I need to escape the curly braces meant for Facebook (which works, but looks kind of ugly and is hard to read):\r\n\r\n    @GET(\"/me?fields=id,email,first_name,gender,last_name,link,locale,name,timezone,verified,picture.type(large)%7Bis_silhouette,url%7D,age_range\") JsonObject getUser(@Query(\"access_token\") String userToken);\r\n\r\nSuggestion:\r\n\r\nIf you don't see any negative side effects, I would suggest allowing to escape { with {{ and } with }} if the curly braces are meant for the API and not for retrofit.\r\n\r\nYou could run a simple pre-check which replaces {{ with %7B and }} with %7D and the user would have a better readable endpoint definition:\r\n\r\n    @GET(\"/me?fields=id,email,first_name,gender,last_name,link,locale,name,timezone,verified,picture.type(large){{is_silhouette,url}},age_range\") JsonObject getUser(@Query(\"access_token\") String userToken);\r\n\r\nI admit it's a special use-case, but Facebook is not nobody ;-)\r\n"},"comment":{"url":"https://api.github.com/repos/square/retrofit/issues/comments/77204623","html_url":"https://github.com/square/retrofit/issues/754#issuecomment-77204623","issue_url":"https://api.github.com/repos/square/retrofit/issues/754","id":77204623,"user":{"login":"oliverhausler","id":8090341,"avatar_url":"https://avatars.githubusercontent.com/u/8090341?v=3","gravatar_id":"","url":"https://api.github.com/users/oliverhausler","html_url":"https://github.com/oliverhausler","followers_url":"https://api.github.com/users/oliverhausler/followers","following_url":"https://api.github.com/users/oliverhausler/following{/other_user}","gists_url":"https://api.github.com/users/oliverhausler/gists{/gist_id}","starred_url":"https://api.github.com/users/oliverhausler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oliverhausler/subscriptions","organizations_url":"https://api.github.com/users/oliverhausler/orgs","repos_url":"https://api.github.com/users/oliverhausler/repos","events_url":"https://api.github.com/users/oliverhausler/events{/privacy}","received_events_url":"https://api.github.com/users/oliverhausler/received_events","type":"User","site_admin":false},"created_at":"2015-03-04T17:32:04Z","updated_at":"2015-03-04T17:32:04Z","body":"We could also use Java-style escape, such as \\{ and \\} to tell Retrofit to ignore a brace. Probably cleaner than {{ or }} if \\ does not cause problems otherwise."}}