python - Does converting json to dict with eval a good choice? -
I am getting a Jason object from a remote server, and converting it into a string string like this:
A = eval (feedback) Is it stupid in any way, or do I have a better option?
-
JSON isn ' true , < Due to code> false , and null also does not have valid python. -
The Python code will be executed for eval , so you can come to the mercy of the malicious injection of code. json is available in the standard library instead of the module: import json data = json.loads ( "[1, 2, 3]") Using a version of older Python than 2.6, you have to download the module. It is called simplejson and may be.
Comments
Post a Comment