Possible Duplicate:
What are the u’s when I use json.loads?
Attempting to encode some string data into json in PHP via json_encode and pass it to my python script on the same server:
This data's going to contain quotes, and will have an embedded array full of strings of urls.
$data =array("test.com", array("http://google.com", "http://cnn.com"), "ASDASDASD");
$jsonified = json_encode($data);
shell_exec("python /path_to_script/script.py '".$jsonified."'");
which will hopefully run the script with the data as it's first argument.
Right now, I'm kinda rolling with just making sure it can load into a thing properly:
import json
import sys
encoded = sys.argv[1]
print "ENCODED: ", encoded
decoded = json.loads(encoded)
print "DECODED: ", decoded
and I'm calling it this way:
~$ python json-test.py '["test.com", ["http://www.google.com", "http://cnn.com"], "ASDASDASDASD"]'
ENCODED: ["test.com",["http://www.google.com", "http://cnn.com"], "ASDASDASDASD"]
DECODED: [u'test.com', [u'http://www.google.com', u'http://cnn.com'], u'ASDASDASDASD']
What's with the 'u's? Also am I correct in hoping this will somehow go together smoothly?