I'm already using the PHP json_encode function to encode data for some Ajax apps, and the pygtk app I'm working on is an extension of this.
However I get an error with the string below. The crux is that if the "data=" is removed from the front it works in python. However with the "data=" there is fails in Python but works on browsers?
So which is incorrect, the browsers interperation or the json.py ??
Apart from that it works great. It would also ne nice to have a couple of examples on the website and am prepared to do that.
Regards
Pete
-- Dont like this ---
in php >> echo 'data='.json_encode($users);
data={"3":{"user":"Beth Morgan","status":"out","date_in":"2006-11-05 10:00:00","dat":"2006-11-05","tim":"10:00:00"}}
-- This is ok ---
echo json_encode($users);
{"3":{"user":"Beth Morgan","status":"out","date_in":"2006-11-05 10:00:00","dat":"2006-11-05","tim":"10:00:00"}}
Logged In: YES
user_id=405789
Originator: YES
Here's the python script for reading the json (testing stage)
url = self.config['url']
req = urllib2.Request( url )
response = urllib2.urlopen(req)
page_contents = response.read()
print page_contents
import json
print "-------------"
obj = json.read(page_contents)
print obj