How to change the value of an object in .json in python

1

How do I change the value of an object in .json in python (without rewriting it all)? Ex:

{
    "Nome": "Henrique Antônio de Oliveira"
    "Cidade": "São Paulo"
    "Estado": "São Paulo"
    "Idade": "23"
    "Número do Pedido:": "457835"
}

How would I change his age without rewriting the whole .json? Since then I thank you!

    
asked by anonymous 19.11.2016 / 20:24

1 answer

1

Changing the value by the key. Example:

import json

j = json.loads('{"Nome": "Fulano", "Idade": "23"}')
j['Idade'] = '12'

IDEONE

    
19.11.2016 / 20:39