1

Is there a way to parse a Python command line into a json value and execute it back on python. Json example:

{
  "identifier": {
    "command":"print(\"Things to print\")",
  }
}

Example in python and how would be able to execute it?

print = data['identifier']['command']
Karl Knechtel
  • 62,466
  • 11
  • 102
  • 153
  • If the linked duplicate above doesn't answer your question, please [edit] the question to show what you tried and how it didn't work, to clarify / distinguish. – Charles Duffy Apr 15 '21 at 15:52
  • @CharlesDuffy I'm not sure much sense can be made of the question; as best I can figure it out, it's asking to do something that would be an *extremely bad idea*. – Karl Knechtel Apr 15 '21 at 15:53
  • @KarlKnechtel, ...certainly, it's a bad idea; but if someone _wants_ to pursue that particular bad idea, the duplicate describes it. (The security impact is a whole 'nother question). – Charles Duffy Apr 15 '21 at 16:09

0 Answers0