Update NULL in numeric field ArcGIS rest API python

1018
1
11-05-2018 11:56 PM
OmerBen-Asher
New Contributor III

Hi,

I am trying to update / add from a python script to ArcGIS feature server with the rets api.

The problem is when I have a null value in a numeric field the server fail. It allow me to use null but not to use “null”. The problem is in python when you build the object to be send to the server you can’t just insert null you have to use the “null”. Python null is None and the server doesn’t get None.

 

Any ideas ?

Tags (3)
0 Kudos
1 Reply
RandyBurton
MVP Alum

I use json.dumps to clean up what I send to the server; it converts None to null:

>>> import json
>>> attribs = { 'someValue' : None }
>>> attribs
{'someValue': None}
>>> update_dict = { "features" : json.dumps(attribs) }
>>> update_dict
{'features': '{"someValue": null}'}