AnsweredAssumed Answered

Error converting Json file to a feature class

Question asked by jbridwell_Dewberry on Aug 20, 2018
Latest reply on Aug 20, 2018 by bixb0012

I want to convert some json data being returned from a request to a feature class, but I keep getting a RuntimeError: Object: Error in executing tool. I made a test gdb in a folder 'C:/Workspace/Sandbox/ScratchTests/cslf.gdb' in which to populate my new feature class after conversion. To test that the request is correct and that I am returning Json data, I added a couple of print statements. Otherwise, everything is pretty straight forward. Does anyone see a problem with my code? I am following the arcpy [JSON to Features][1] directions from the documentation. The only thing I am doing differently is instead of using an actual file, I am just plugging in the variable 'cslfJson`.

import arcpy, sys, os, arcgis, requests 
arcpy
.env.workspace = "C:/Workspace/Sandbox/ScratchTests"
params
= {'f': 'json', 'where': '1=1', 'geometryType': 'esriGeometryPolygon', 'spatialRel': 'esriSpatialRelIntersects','outFields': '*', 'returnGeometry': 'false'}
r = requests.get('https://hazards.fema.gov/gis/nfhl/rest/services/CSLF/Prelim_CSLF/MapServer/3/query', params)
print(r.url)
cslfJson
= r.json()
print(cslfJson)
arcpy
.JSONToFeatures_conversion(cslfJson, os.path.join("cslf.gdb", "cslf"))

Outcomes