Good evening,
I want to scrape a "value" from this output:
{
"checkout":
{
"completed_at": null,
"created_at": "2020-02-27T00:32:40+01:00",
"currency":"EUR",
"presentment_currency":"EUR",
"customer_id":2929596792912,
"customer_locale":"de"
...
and so on....
My attempt:
import json
Json = json.loads(info.text)
currency= Json1.get("currency")
print(currency
But I just get None
when I print the answer
Once you have parsed the input using the json
library you have a python dictionary.
The reason get("currency")
returns None
is because the key currency
does not exist at the top level of your dictionary.
If you try
currency = Json.get("checkout").get("currency")
you should get the value EUR