samedi 8 août 2020

Python: How to check if the value of the key "x" is equal to "value-any" in json?

follow my example:

I have a Json file Whose "license key is equal to" valid " Ex:

{
license: "valid", 
email: "joaodascoves@gmail.com",
site: "google.com"
}

How do I create a conditional:

if the key value "license" is equal to "valid"

I return an X command, if it is "invalid" I return the command "y"

I need this, because I want to create a licensing system that will analyze the json by url, and check if the key "license" returns as "valid" or "invalid" and thus execute the different commands depending on these two conditions.

Forgive me, as I am totally a layman in Python. I thank you very much for the answers.

Aucun commentaire:

Enregistrer un commentaire