In a Python script I run json_decoded = json.load(file)
that results in the following JSON data:
json_decoded = {
"data": {
"keyA": [
{
"subkeyA1": "valueA1",
"subkeyA2": "valueA2"
},
{
"subkeyA3": ""
}
],
"keyB": []
}
}
I would like to remove all the []
and ""
("empty") key-value pairs so to have:
json_decoded = {
"data": {
"keyA": [
{
"subkeyA1": "valueA1",
"subkeyA2": "valueA2"
}
]
}
}
How can I have that?
Note: I am pretty new to Python (v2.7.3).