Extracting User Data from JSON in Python

mail@pastecode.io avatar
unknown
python
a month ago
265 B
4
Indexable
Never
import json

with open('desafio.json', encoding='utf-8') as desafio_json:
    dados = json.load(desafio_json)
    
    print(dados['user'][1]['email'])
    
    print(dados['user'][0]['address']['city'])

    print(dados['user'][1]['orders'][0]['total'])
Leave a Comment