I'm trying to convert some open-source data in JSON format to a shapefile for use in ArcGIS Desktop. I'm attempting to do this in ArcPy with ArcMap 10.7. The data I'm trying to access is here, in JSON format:
And my script:
#access the JSON from web link
bikeLanesRaw = 'https://data.sfgov.org/resource/ygmz-vaxd.json'
bikeLanesRawResponse = urllib2.urlopen(bikeLanesRaw)
bikeLanesRaw_JSON = bikeLanesRawResponse.read()
#Write each response to JSON
foo = open(bikeFacilitiesFolder + "\\" + "bikeLanes_SF.json", "wb")
foo.write(bikeLanesRaw_JSON);
foo.close()
#Convert JSON to shapefile - THIS FAILS
arcpy.JSONToFeatures_conversion(bikeFacilitiesFolder + "\\" + "bikeLanes_SF.json", bikeFacilitiesFolder + "\\" + "bikeLanes_SF.shp")
Everything works as expected until the final line, where I try and convert the JSON to features. It gives me the error:
ExecuteError: ERROR 001558: Error parsing json file 'Bike Facilities Data\bikeLanes_SF.json'.
Failed to execute (JSONToFeatures).
I've read more of ESRI documentation, and they say:
Review the JSON structure in the input file. The JSON must have at least the geometryType, spatialReference, fields, and features (with geometry and attributes) property.
What do I do if the JSON does not have this information to begin with?