Using python on web2py server I have following problem. How do I loop trough json to find all the keys that have null values (or empty strings) and collect those keys to report what is missing:
This is my json example.
{
"version" : 1,
"general" : {
"scriptFrom" : "",
"scriptTo" : "1.1.2014",
"scriptComment" : "dada"
},
"nbworkersDays" : [{
"days" : ["1", "2"],
"data" : [{
"nbWorkersFrom" : 2,
"nbWorkersTo" : null,
"timeFrom" : "12:00",
"timeTo" : ""
}
,{
"nbWorkersFrom" : 2,
"nbWorkersTo" : 7,
"timeFrom" : "9:00",
"timeTo" : "14:00"
}
]
}
]}
I was thinking to retrieve a list with all keys and if nested than first level . second level. missingData= [scriptFrom, nbworkersDays.nbWorkersTo, nbworkersDays.timeTo]
any suggestions on how to solve this or how would you collect all the errors to report back to client (I have a web app using web2py) thank you