[Developers] Change in JSON output

Kendra Kuhl kendra.kuhl at juggle.com
Wed Mar 4 18:10:30 UTC 2009


Will,

What is the best way for the developers to know that there is a release
cycle coming up? 

Kendra

-----Original Message-----
From: developers-bounces at freebase.com
[mailto:developers-bounces at freebase.com] On Behalf Of Will Moffat
Sent: Wednesday, March 04, 2009 11:44 AM
To: Freebase API and apps built on Freebase For discussions about MQL
Subject: [Developers] Change in JSON output


Dear Developers,

The JSON output by the mqlread API has changed yesterday. Forward  
slashes are now escaped (which is ugly but legal JSON).
To avoid dependancy on the particular JSON format, we recommend  
parsing any JSON string before using the response.

Apologies for not highlighting this change in advance.

(This might be a good time to plug sandbox-freebase.com which lets you  
test your code against our APIs ahead of the official release cycle)

regards,
--Will



Example of the new output:
-------------------------------------

http://www.freebase.com/api/service/mqlread?query={"query":{"id":"/ 
type/int"}}

{
   "code": "\/api\/status\/ok",
   "result": {
     "id": "\/type\/int"
   },
   "status": "200 OK",
   "transaction_id": "cache;cache01.p01.sjc1:8101;2009-03-04T17:28:13Z; 
0044"
}



Parsing in Python:
-------------------------

import urllib, simplejson
url='http://www.freebase.com/api/service/mqlread?query={"query": 
{"id":"/type/int"}}'
simplejson.load(urllib.urlopen(url))

{u'code': u'/api/status/ok',
  u'result': {u'id': u'/type/int'},
  u'status': u'200 OK',
  u'transaction_id':  
u'cache;cache01.p01.sjc1:8101;2009-03-04T17:32:04Z;0044'}


Parsing in JS - http://www.json.org/js.html
------------------

JSON.parse(json_str)

_______________________________________________
Developers mailing list
Developers at freebase.com
http://lists.freebase.com/mailman/listinfo/developers



More information about the Developers mailing list