Json Argument Passed From The Command Line With Python Can't Be Decoded
I am trying to pass a command line argument to a python file and load the json but I keep getting a valueerror: No Json object could be decoded. json_test.py: import json import sy
Solution 1:
if you run print sys.argv[1]
you probably get '{favorited:
which the json module cannot decode into a json object.
try escaping your inner quotes so it is passed as 1 argument like so:
"{"\""favorited"\"": false, "\""contributors"\"": null}"
Post a Comment for "Json Argument Passed From The Command Line With Python Can't Be Decoded"