30/09/2010

How to Set JSON Response Data Locale for Facebook Graph API

To make Facebook server return JSON responses in specified locale, you need to add parameter locale to the query, e.g.: https://graph.facebook.com/me?access_token=xxx&locale=en_US
The result is:
{
...
"gender": "male",
"meeting_for": [
"Friendship"
],
"relationship_status": "Married",
...
}


If you want to get results in russian, then add locale=ru_RU to query:
https://graph.facebook.com/me?access_token=xxx&locale=ru_RU
and you'll get result in russian (UTF-encoded):
{
...
"gender": "\u043c\u0443\u0436\u0441\u043a\u043e\u0439",
"meeting_for": [
"\u0414\u0440\u0443\u0436\u0431\u0430"
],
"relationship_status": "\u0416\u0435\u043d\u0430\u0442/\u0437\u0430\u043c\u0443\u0436\u0435\u043c",
...
}

redirect