Hi,
I have a json that I'm going to use to update features on an arcgis server.
The syntax of my json is:
_result= [{"attributes":{"OBJECTID":objectid, "ATTRIBUTE1": A1 , "ATTRIBUTE2": A2 , "ATTRIBUTE3": A3,"ATTRIBUTE4": A4, ... ,"ATTRIBUTEN": AN}}]
How can I automatically remove the entries with null values?
For the example above, if A2 is NULL or '' then the json should be:
_result= [{"attributes":{"OBJECTID":objectid, "ATTRIBUTE1": A1 , "ATTRIBUTE3": A3,"ATTRIBUTE4": A4, ... ,"ATTRIBUTEN": AN}}]
I tried the fillowing code inside a python caller without success.
def remove_null(feature):
js = feature.getAttribute('_result')
for key, value in js.items():
if value == None or str(value)='':
del js[key]
feature.setAttribute('_result_bis',js)
Thanks