Can't seem to get booleans out of JSON and into database

69
0
12-09-2020 07:29 AM
MikeQuetel1
New Contributor III

Hi,

I'm polling for JSON and inserting/updating a SQL Server backed feature class.  It's mostly working... I'm getting features into the database, but I just can't seem to handle the booleans  in the JSON correctly.  

There is sample data from the feed at the bottom of this post... for example, the "has_kisosk" field is going to be true/false.

The input geoevent definition has that field as a bool, and if I write that event directly out to JSON, the value comes across fine. Getting it into the database is the problem.  My database schema is a bit different in terms of field names.  Also, booleans are stored as smallint or bit fields in SQL Server (I'm using smallint).

So, my output geoevent defintion has the boolean field as type "short"and I use a field mapper to make that transformation from input to output geoevent defintion.

The problem is that all boolean fields come across as null from the output geoevent def.  This is consistent in the database as well as if I write this output geoevent defintion to JSON.  If I make the output geoevent defintion also use type "boolean" then I can see the values in my output JSON, but the feature service records the following in the ArcGIS server log:

 

 

Error: The value type is incompatible with the field type. [HAS_KIOSK].

 

 

So it seems like booleans aren't being automatically transformed into shorts (or other integer types).  Can anyone provide some pointers on how to handle this?

Thanks in advance!

 

 

 

{
	"data": {
		"stations": [{
			"lat": 45.51898132,
			"rack_model": "CITY_PILOT_RACK",
			"legacy_id": "1440914125193298376",
			"address": "Park Avenue West, Southwest Yamhill Street, Portland",
			"region_code": "PDX",
			"name": "SW Yamhill at Director Park",
			"eightd_station_services": [],
			"rental_uris": {
				"android": "https://pdx.lft.to/lastmile_qr_scan",
				"ios": "https://pdx.lft.to/lastmile_qr_scan"
			},
			"capacity": 20,
			"eightd_has_key_dispenser": false,
			"station_id": "1440914125193298376",
			"lon": -122.6812685,
			"station_type": "lightweight",
			"has_kiosk": false,
			"electric_bike_surcharge_waiver": false,
			"external_id": "motivate_PDX_1440914125193298376",
			"dockless_bikes_parking_zone_capacity": 20,
			"client_station_id": "motivate_PDX_1440914125193298376"
		}]
	}
}

 

 

 

 

Reply
0 Kudos
0 Replies