Come posso scorrere il seguente file JSON e se fa = "cc.ee" quindi aggiungere un valore all'interno di fb?parsing json python
{
"pk": 1,
"fa": "cc.ee",
"fb": {
"fc": "",
"fd_id": "12345",
}
},
#!/usr/bin/env python
import json,urllib
json_data=open("my.json")
data = json.load(json_data)
for entry in data:
json.dumps(entry)
json_data.close()
exit
Si noti che il [JSON Validator] (http://jsonlint.com/) ha problemi con il tuo JSON. Valida se rimuovi le ultime due virgole (vedi 'json_string' nella risposta di Pablo). –