[Developers] Change in JSON output
Jason Douglas
jason at metaweb.com
Wed Mar 4 18:38:58 UTC 2009
It should not affect any library that uses a compliant JSON parser,
including Acre.
-jason
On Mar 4, 2009, at 10:24 AM, Tom Morris wrote:
> Does this change affect applications written on Acre? What about
> users of MJT or the Python library?
>
> Tom
>
> On Wed, Mar 4, 2009 at 12:44 PM, Will Moffat
> <willmoffat at metaweb.com> wrote:
>>
>> 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
>>
> _______________________________________________
> Developers mailing list
> Developers at freebase.com
> http://lists.freebase.com/mailman/listinfo/developers
More information about the Developers
mailing list